Variables

Edited on December 14, 2016

Reserved variables

Dynamic variables at Test Plan level

Some variable names are reserved for accessing specific information within the STEP context.

[[input.getString('my_json_arg_name')]] : allows access to the arguments passed from/to a composite keyword

[[dataPool]] : default item name in a ForEach, allows access to the dataPool cursor (either an excel line or the Map translation of a JDBC Row)

Dynamic variables at Javascript Engine level (inside the scripts)

input : a collection used to communicate the inputs from the controller to the scripting engine and make them accessible to use inside the script. Example of usage : input.getString("<wbr/>my_argument_key")

output : a collection used to communicate the outputs back to the controller and make them accessible for verification in the Test Plan. Type: javax.json.JsonObject; Example of usage : output.getString("<wbr/>my_output_key")

Dynamic variables inside a selenium script

See section "Using Keywords" in the dedicated Selenium paragraph.

Static variables

A number of predefined variables can influence the behavior of STEP. Those variables can be set in the step.properties file of the controller or / and overwritten at any time throughout the execution of a Test Plan using the logic controller "Set" :

tec.execution.threads : defines the number of threads to be started at the TestSet level (unit=Number)
tec.executor.threads : defines the maximum global number of threads which can be executing tests at a given point in time (unit=Number)
tec.continueonerror : defines whether the execution of a Node must continue after an error occured (value:true|false)

Groovy interpretation layer

The execution of Test Plans (whether keywords or plans) is interleaved with the interpretation of groovy scripts allowing you to set dynamic variables and inject groovy code wherever you like within the execution flow of your test. This is particularly useful to set keyword inputs dynamically. For example, you can execute a SQL query "just in time", right before keyword executes and feed the query result to that keyword as an input.

  • Syntax

    • In an expression block

      • Simply write your groovy code

    • Pre-parsed inside a json string

      • Use double brackets to declare your groovy code and leave all of the regular json characters in there.

  • Examples

    • expression=output.getString("output1")=="val1"

    • argument={"url": "http://denkbar.io", "testData" : "[[my_variable]]"}

    • Set.key=my_connection; Set.expression=groovy.sql.Sql.newInstance('jdbc:mysql://localhost/SID', 'USR', 'PWD', 'com.mysql.jdbc.Driver')