Parameters
Parameters are used to define variables which will be accessible from the whole platform in any Plans and Keywords. You can think about Parameters the same way as “Global” variables.
Parameters definition
Parameters minimalistic form is composed of a Key and Value which are defined as String only. In addition to the required Key and Value fields, a Parameter behaviour can also be modified using below fields :
- Activation expression : a JavaScript (Nashorn) expression can optionally be used here to set the parameter value. Following bindings are available for use in activation expressions :
- user : the currently logged in user
- screen settings : any defined screen settings can be used via ID
- Priority : define the order in which the activation expression will be evaluated (descending order : the higher the priority, the sooner the expression will be evaluated)
Examples
Basic example
To create a Parameter, click on the top level menu Parameters then on the top right “New” button.
Fill in the Key and Value fields then press save.
You can now use “myBasicParameter” in any of your Plan / Keywords :
Using activation expression
Let’s now use activation expression to set a parameter (log level in that example) depending of the “Environment” setting.
We have to create the “log” parameter twice (but with different activation expressions):
- execution on “TEST” environment will set the parameter value to “Debug”
- execution on “PROD” environment will set the parameter value to “Error”
You can verify that the value is properly set by running a simple Echo on both environment :
Using prioritized activation expression
In addition, activation expressions evaluation can be prioritized via the “Priority” setting. In below example, we will define the “log” value to be Error for both Environments with a higher expression priority that the one set for the “Test” environment only :
The expected behaviour is that on each environment, the log level will be set to Error.