Variables

Variables

In testRigor, variables allow users to parameterize values, work with dynamically generated information, or pull test data from a global bank of variables in testRigor. To use a variable in a command, add stored value or saved value before the variable in double quotation marks.

It is important to understand that variables have a hierarchy in which they can be overridden.

Built-in variables

testRigor has built-in variables that users can access for things like the current date and time, the base url, and the username and password (given the username and password have been saved in settings), among others. Built-in variables do not override any other variable.

Global variables

Global variables must be uploaded into the test data storage bank in testRigor by the user. These can be in the form of text, hidden strings, files, and multiline strings. In order of priority, global variables override built-in variables. Read more about global variables here.

Data Sets

Data sets have two main uses in testRigor. First, it allows users to test the same scenarios multiple times simultaneously using different parameters or test data. Some users do not need to test simultaneously, but rather swap out entire sets of global variables in order to test scenarios on environments with slight differences. This is easy to do now that testRigor allows users to link/unlink multiple or all test cases to a data set.

Data sets can be created manually or by uploading a csv file as explained in this document and can also be in the same forms as global variables. In terms of hierarchy, data sets override global variables and built-in variables.

Script-generated variables

Variables saved by a command in the script are the most dynamic type and override variables of all other origins. They can be generated in the script in the following ways:

Parameters

You can concatenate variables with other variables or variables with static strings in most commands by adding from the string with parameters or from the string with escaped parameters. Variables inside a string with parameters are indicated by using a $ and curly brackets {} around the variable key as follows: ${variable}
enter from the string with parameters "${homePrefix}/my/path" into "urlPath"
Generate unique date and time with unique parameters either by regex or symbols.
generate from template by string with escaped parameters "${nowDateTimeIso}-**********", then enter into "Data" and save as "generatedData"
Multiple files upload can be done like so:
enter from the string with parameters text starting from next line and ending with [END]
${file_var_one}
<FILE_URL>
[END] into file input "myFileInput"

In the case of identical syntax, a defined rule always has higher priority than general syntax.

You can combine static text with variables, for example:

Fill in the form:
generate unique name, then enter into "First Name" and save as "firstName"
generate unique name, then enter into "Last Name" and save as "lastName"
Then, on the next page, perform a validation
check that page contains a string with parameters "Welcome, ${firstName} ${lastName}!"

Test your knowledge

generate by template “${nowDateTimeIso}-“, and save in “Data”
generate time using template “${nowDateTimeIso}-“ and store as “Data”
generate from template by string with escaped parameters “${nowDateTimeIso}-“, then enter into “Data” and save as “generatedData”
template “${nowDateTimeIso}-“ to generate and save as “Data”
input multi-files using “${file_var_one}” to “myFileInput”
use “${file_var_one}” and “<FILE_URL>” and load to “myFileInput”
enter from the string with parameters text starting from next line and ending with [END]
${file_var_one}
<FILE_URL> [END] into file input “myFileInput”
upload multiple “${file_var_one}” and “<FILE_URL>” to “myFileInput”
generate unique email, then enter into “Your Email” and save as “emailID”
generate unique name, then enter into “First Name” and save as “firstName”
generate email, then enter and save as “Your Email”
generate unique emailID, then enter into “Your Email” and save as “emailID”