【Robot Framework】BuiltIn库

   As a form language, in order to maintain a simple structure, RF did not provide similar if else while such as built-in keywords to achieve a variety of logic functions, but to provide to the user BuiltIn library like other high-level language. If you want to implement more complex logic in the test case, it would need to have some understanding of BuiltIn the important keywords. BuiltIn library also encapsulates many common methods and keywords can control the operating status of the RF, RF is good if you want to use, be sure to have a more comprehensive understanding of the BuiltIn library functions. Here we learn what BuiltIn library with the more important keywords.

Evaluate Keyword:

Arguments:[ expression | modules=None | namespace=None ]Evaluates the given expression in Python and returns the results.

If you need to do some number crunching and get results, you need to use Evaluate keywords. Evaluate expression would you want to calculate directly passed to Python, Python and the results returned to you. This is the most frequently use to.
 
Should series Keywords:
Should the series starts with a series of keywords is Should keyword.
Should Be Empty-------- Verifies that the given item is empty. 
Should Be Equal------- -Fails if the given objects are unequal. 
Should Be Equal As Integers -------- Fails if objects are unequal after converting(转换) them to integers. 
Should Be Equal As Numbers-------- Fails if objects are unequal after converting(转换) them to real numbers. 
Should Be Equal As Strings-------- Fails if objects are unequal after converting(转换) them to strings. 
Should Be True-------- Fails if the given condition(状态) is not true. 
Should Contain-------- Arguments:[ container | item | msg=None | values=True | ignore_case=False ]Fails if container does not contain(包含) item one or more times.
Should Contain X Times-------- Arguments:[ item1 | item2 | count | msg=None | ignore_case=False ]Fails if item1 does not contain item2 count times.
Should End With-------- Arguments:[ str1 | str2 | msg=None | values=True | ignore_case=False ]Fails if the string str1 does not end with the string str2.
Should Match-------- Arguments:[ string | pattern | msg=None | values=True | ignore_case=False ]Fails unless the given string matches the given pattern.
Should Match Regexp --------Arguments:[ string | pattern | msg=None | values=True ] Fails if string does not match pattern as a regular expression(正则表达式).
Should Start With-------- Arguments: [ str1 | str2 | msg=None | values=True | ignore_case=False ] Fails if the string str1 does not start with the string str2.
Should Not Be Empty
Should Not Be Equal
Should Not Be Equal As Integers
Should Not Be Equal As Numbers
Should Not Be Equal As Strings
Should Not Be True
Should Not Contain
Should Not End With
Should Not Match
Should Not Match Regexp
Should Not Start With
When using these keywords are used to determine, for each use case will be used, such as our execution result of a string, we have to determine the string to be equal to an expected string, or use cases can not pass, At this time, will certainly spend Should be Equal As String key, we can name suggests other keywords keywords by name, know what it does.
 
Convert To Series Keywords:
Convert To Binary
Convert To Boolean
Convert To Hex 
Convert To Integer 
Convert To Number 
Convert To Octal 
Convert To String
Do type conversion, to convert a value to the corresponding type.
 
Run keyword Series keyword:
Run Keyword If------ Arguments: [ condition | name | *args ]Runs the given keyword with the given arguments, if condition is true.
Run Keyword If All Critical Tests Passed
Run Keyword If All Tests Passed
Run Keyword If Any Critical Tests Failed
Run Keyword If Any Tests Failed
Run Keyword If Test Failed
Run Keyword If Test Passed
Run、Keyword If Timeout Occurred
These keywords are keywords based on whether a judge true and false conditions of view. These keywords are generally used to implement advanced functionality ifelse language. The most common is the effect of Run Keyword If and Run Keyword unless they both achieve the opposite.
 
Exit For Loop Keywords:
Used to exit the loop, general and Run Keyword If the keywords used in combination to achieve the conditions to exit.
 
Wait Until Keyword Succeeds Keywords:
This is an asynchronous call would become the keyword synchronous calls. As an example: If you operate a call to a WebService, and the results need to be returned to do next. We will use this keyword
 
BuiltIn Curry there are many Baby
Such as date relevant keywords GetTime.
Let's test pause, etc. Sleep. They are quite useful.
Currently, only two internal RF keywords: FOF and IN, the cyclic structure is achieved. Function is relatively weak.
 

Guess you like

Origin www.cnblogs.com/ronyjay/p/11316939.html