Set Global/Suite/Test Variable
Set Global Variable | name, *values | Makes a variable available globally in all tests and suites. Variables set with this keyword are globally available in all test cases and suites executed after setting them. Setting variables with this keyword thus has the same effect as creating from the command line using the options '--variable' or '--variablefile'. Because this keyword can change variables everywhere, it should be used with care. See Set Suite Variable for more information and examples. | ||||||||||||||||||||||||||||||||||||||
Set Suite Variable | name, *values | Makes a variable available everywhere within the scope of the current suite. Variables set with this keyword are available everywhere within the scope of the currently executed test suite. Setting variables with this keyword thus has the same effect as creating them using the Variable table in the test data file or importing them from variable files. Other test suites, including possible child test suites, will not see variables set with this keyword. The name of the variable can be given either as a normal variable name (e.g. ${NAME}) or in escaped format as \${NAME} or $NAME. If a variable already exists within the new scope, its value will be overwritten. Otherwise a new variable is created. If a variable already exists within the current scope, the value can be left empty and the variable within the new scope gets the value within the current scope. Examples:
To override an existing value with an empty value, use built-in variables ${EMPTY} or @{EMPTY}:
NOTE: If the variable has value which itself is a variable (escaped or not), you must always use the escaped format to reset the variable: Example:
This limitation applies also to Set Test/Suite/Global Variable, Variable Should (Not) Exist, andGet Variable Value keywords. | ||||||||||||||||||||||||||||||||||||||
Set Test Variable | name, *values | Makes a variable available everywhere within the scope of the current test. Variables set with this keyword are available everywhere within the scope of the currently executed test case. For example, if you set a variable in a user keyword, it is available both in the test case level and also in all other user keywords used in the current test. Other test cases will not see variables set with this keyword. See Set Suite Variable for more information and examples. | |||||||||||||||||||||||||||||||||||||||||||||||||||||
Set Test Variable | name, *values | Makes a variable available everywhere within the scope of the current test. Variables set with this keyword are available everywhere within the scope of the currently executed test case. For example, if you set a variable in a user keyword, it is available both in the test case level and also in all other user keywords used in the current test. Other test cases will not see variables set with this keyword. See Set Suite Variable for more information and examples. | |||||||||||||||||||||||||||||||||||||||||||||||||||||
Set Variable | *values | Returns the given values which can then be assigned to a variables. This keyword is mainly used for setting scalar variables. Additionally it can be used for converting a scalar variable containing a list to a list variable or to multiple scalar variables. It is recommended to useCreate List when creating new lists. Examples:
Variables created with this keyword are available only in the scope where they are created. SeeSet Global Variable, Set Test Variable and Set Suite Variable for information on how to set variables so that they are available also in a larger scope. | |||||||||||||||||||||||||||||||||||||||||||||||||||||
Set Variable If | condition, *values | Sets variable based on the given condition. The basic usage is giving a condition and two values. The given condition is first evaluated the same way as with theShould Be True keyword. If the condition is true, then the first value is returned, and otherwise the second value is returned. The second value can also be omitted, in which case it has a default value None. This usage is illustrated in the examples below, where ${rc} is assumed to be zero.
=> ${var1} = 'zero' ${var2} = 'value2' ${var3} = None It is also possible to have 'Else If' support by replacing the second value with another condition, and having two new values after it. If the first condition is not true, the second is evaluated and one of the values after it is returned based on its truth value. This can be continued by adding more conditions without a limit.
Use Get Variable Value if you need to set variables dynamically based on whether a variable exist or not. | |||||||||||||||||||||||||||||||||||||||||||||||||||||
Log Variables | level=INFO | Logs all variables in the current scope with given log level. |