The ability of RF is provided by keywords, so you must know the commonly used keywords of RF in order to use RF well.
Commonly used RF keywords are in the RF standard library.
http://robotframework.org
Keyword parameter
The first column is the name of the keyword.
The second column is the parameter of the keyword.
Common keywords
Set variable only supports assigning strings to variables. If we want to specify an integer or floating point number, we need to use convert to integer convert to number.
If we want to take a number as a parameter of a keyword, we can use a numerical variable.
There should be two differences between real and python:
1. Add a $ sign before the variable.
2. There should be no more than two spaces in the middle.
Cognitive test library
Usually, keywords are provided by trying to cry. In fact, the test library is a python module file.
Keywords are functions and methods of classes in python library.
RF is a python program, so it looks for library files on the same principle as python. Finally through sys.path.
The directory where we run robot is the current working directory, which is in sys.path. So we can directly find python module files in our current directory.
RF scripts use function names, method names, and are case-insensitive.
Import of library
To use the keywords provided by test cry, we must declare the import library. Of course, it is a special case: there is no need to declare keywords except the built-in library of RF.
In RF, the name of the library is case-sensitive.
Some libraries can provide parameters when importing, such as SeleniumLIbrary.
http://fobot framework . org/selenium library/selenium library . html
Import link, click, parameter import setting parameters.
Timeout =5.0
Run _ on _ faullure = Capture a screenshot of the page.
Screenshot _ Root = None
In fact, these libraries are all imported with parameters, and the corresponding test libraries are all implemented with classes.
These parameters are the parameters in the initialization method init of this class.
Use of variables
The variable in RF is essentially a python variable, and he just wants a python object.
So what kind of object does Python object RF variable correspond to?
spread
RF uses: FOR to realize the loop, and there is no while loop.
The corresponding documents are described here.
http://robot framework . org/robot framework/latest/robotframeworkuserguide . html # for-loops
: FOR \ For the old syntax,
Because the ending is a new grammar.
Range use
In python, we often use the range method, and RF has similar support.
http://robot framework . org/robot framework/latest/robotframework user guide . html # id 578