Just curious because I'm in the midst of creating a Global Var files which will be imported through QTP resources. Just wondering when would I use a INI file over a Global Vars file? I'm using the Global Var file to hold different paths to .vbs files and my main excel suite file. Is there an advantage to using one over the other...or are they used for two different reasons. I'm hoping someone can shed some light on this...thanks.
INI files or XML files are used to pass your environment variables accross all tests.
e.g. of INI
setting all tests to run on www.QA1.Test.com
next time you want to run your tests against QA2 you just have to change only QA1 above to QA2.
hope it is clear?
"I realize it's an error, but no one is going to try to do that!"
From "Top 10 Stupid Comments from Developers".
Thanks for the reply, but in scenario you provided couldn't I just declare a constant with the path I wanted in a separate vbs file and include it into the QTP resources and have the same effect? I'm asking because I want to elimate all possible hard coding of paths, especially ones that reference vbs files that are used in ExecuteFile statements.
The scenario, Nadim has provided, can do whatever you need.
You don't need multiple VBSs for that. Just one. Assosiate it with every test case. And inside of this script read value of SystemUnderTest from INI.
You would control only this value.
Only in one file.
No script, no test cases would be touched if you need to change the system.
In INI file:
read this value and put it in some variable,
accosiate ExecuteFile "VBscrip.vbs"
Execute your application with parameter 'CurrentSystem'...
Just one thing:
You can not read INI with Environment.LoadFromFile from VBscript as you normaly do from TestCase. You need to read it with External.Declare