Session/Suite Variables

Session variables are similar to Local variables except that their scope spans the whole test suite i.e. all the test cases within a suite. For example, if a set of test cases require Current Date as a test input, one can define a date variable at the test suite level and reference it in all the test cases as opposed to getting the date every time.

Action/command will be SET, screen name will be blank, variable name will go into Element and its value will go in the parameters as shown in step 2 in below snapshot.

Here, $S is used in order to indicate that this is a suite level variable.

It creates a suite level variable named “currentdate” with value as “1/1/2020” and the scope of the variable is limited to complete test suite. If there are 10 test cases in the suite, then user can define a suite variable in test case 1 and can use it in any test case from 2 to 10.

Note: Test case containing a suite/session variable must be executed prior to test cases seeking that particular session/suite variable value.

Now, in order to use this variable, user has to use variable name along with the $ sign as given below:

Syntax: ${variable name} Example: ${currentdate}

Was this page helpful?