| || |
How to retain global variable value
This is a follow-up post to my previous post concerning testing of 2 differnet versions of the AUT.
I was able to set a global variable with the correct window declaration depending on the version of the AUT I'm running tests on using "if" statements. My problem now is that when I use the agent on different machines and run tests in concurrent mode, my global variable looses it's value and my tests fail because the correct window declaration is not found. For example, in my appstate declaration, I grab the window caption when the app is started and parse out the version number. I then use if statements to set the global variable depending on what version of the app is on the machine.
wWindow = wMainwin.Toolbar.DialogBox1
wWindow = wMainwin.Toolbar.DialogBox1.PageList1
Does anyone have any suggestions on how to make the global variable retain it's value throughout the test runs, or some other way of dealing with this problem?
Re: How to retain global variable value
There are many ways you can do it...
One way is to declare it as a compiler constant (in your settings).
Another way is to declare it as a constant outside the testcases, in your include files or outside main().
The last way incase you're using organizer to execute all your testcases, you can always use IniWrite() and IniRead() functions in your TestcaseEnter() and TestcaseExit() functions to pass variables between testcases. The ini functions can be downloaded in the Downloads section, (QAPLib1)