Scope of global variable

A global variable is accessible throughout all test modules and actions within an execution.

If the same global variable is declared twice, the second global variable declaration action assigns a new value to the existing global variable.


Example:

Script:


Result:


In the case, you want to assign a value to an EXISTING global variable, the “set global variable” action should be used. The reason is:

- A warning message will appear if the variable does not exist.

- It is easy to change the name (just search old name which is declared in “global variable” action and change), management, apply ABT…


Scope of local variable

Unlike global variables, local variables have a limited scope depending on where the local variable is declared.


User case 1:


Example:

Script:

Declare a local variable name “a” with the value “This is local variable” in the INITIAL section. This “a” variable is able to be called in all test cases and the FINAL section.


Result:


User case 2:


Example:

Script:

Declare a local variable name “a” with value is “This is local variable” in the TEST CASE 01 section. This “a” variable is able to be called within this TEST CASE 01. Moreover, an error message will be appear if the “a” variable is called from outside of the TEST CASE 01 section.


Result:


User case 3:


Example:

Script:

Declare a local variable name “a” with value is “This is local variable” inside of a high level action. This “a” variable is able to be called within that action. Moreover, an error message will be appear if “a” variable is called from outside of the high level action.


Result: