To use a global variable value in a visual test, the global variable must be stored to, and used as, a local variable defined in a script. Also, the visual test containing this variable must be inserted into any visual test that uses the value. This includes all steps of the visual test containing a global variable, which may produce unwanted test results.
Because of this, we recommended that all global variables for a test solution be created and maintained in one visual test. This has the following benefits:
If a local variable is used to store a global variable, any value previously set for the local variable is changed to the value of the global variable.
A global variable defined in a visual test can have the same name as a local variable. If you modify the global variable value, it does not modify the local variable value that has the same variable name. However, to avoid misuse of data in visual tests and to avoid confusion, ensure that global names are unique from local or other variable names.
Although two visual tests can create global variables of the same name, avoid this practice as well because of the possibility of using a global variable with an unexpected value.