Running Global Variables from a Test Plan Versus Running Them from a Script

Problem

When running from a test plan, global variables don’t keep their value from one test case to another.

When test cases are run from a script, global variables are initialized once at the beginning and do not get reset while the script is being run. On the other hand, when you run test cases from a test plan, all global variables get re-initialized after each test case. This is because the Agent reinitializes itself before running each test case. Consequently, you may find that global variables are not as useful when running from a test plan.

Solution

A workaround is to use the FileWriteLine or FileWriteValue function to write the values of the global variables out to a file, then use the FileReadLine or FileReadValue function to read the value back into each variable in each test case.