Micro Focus QTP (UFT) Forums
programming to use different external file of environment variables - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: programming to use different external file of environment variables (/Thread-programming-to-use-different-external-file-of-environment-variables)



programming to use different external file of environment variables - bundfromnj - 01-18-2012

Hi,
We have an established QTP framework. We use text files (initialization files ) to set our environment variables. To run my test scripts for a particular application - I attach my variable text file through File>Menu>Setting> Environments Tab > User Defined > Attach the file

My requirement is - I have to run the same set of actions (run multiple iterations of my test scripts) using different files.
My files have
I want to automate this small piece where I can direct QTP to pick the variable file automatically and run the desired set of actions --- so for e.g.
I can do with either of 2 scenarios:

1. Decide the set of actions and just change the variable file
Action --- Make online payments using Credit Card
Run the same action for the following user defined environment variable file:
File a ......... file z

my number of iterations essentially depends on the number of files I have - so if I have to attach different files during my tests how can i do it programmatically?


RE: programming to use different external file of environment variables - SteveS - 01-19-2012

Hi,

Can you use:

Environment.LoadFromFile "c:\EnvironmentVars.xml"

Loop round changing the file path as required?

Cheers
s