Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
constants in qtp
#7
Solved: 11 Years, 4 Months, 3 Weeks ago
An external environment variable file can either be a xml file or an ini file.
I would suggest you to use ini as it is easy to maintain. If you want to use xml, read QTP help or google it.

Just create a text file with extension as ".ini". E.g.: "Environment.ini"

In the beginning of the file, add [Environment]

Following that, you can specify the variables and their values... it will look some thing like this...
---
[Environment]

Code:
mybrowser = "www.google.com"
Firstname = "diya"
Lastname = "lastname"
---

To use this file, you have to import it to your script.

Use Environment.Loadfromfile("Path of your environment file")
Eg:
Code:
Environment.Loadfromfile("C:\Environment.ini")

Now you can use it whenever you want.

For example, if you like to open google,

Code:
SystemUtil.Run "iexplore.exe", Environment.Value("mybrowser")
or
Value is the default property of environment, you can use
Code:
SystemUtil.Run "iexplore.exe", Environment("mybrowser")

Hope this helps.

Thanks,
Elango
Reply


Messages In This Thread
constants in qtp - by diya - 12-05-2012, 10:53 AM
RE: constants in qtp - by kalaivanan123 - 12-05-2012, 06:26 PM
RE: constants in qtp - by diya - 12-05-2012, 06:31 PM
RE: constants in qtp - by diya - 12-06-2012, 10:41 PM
RE: constants in qtp - by diya - 12-07-2012, 08:24 PM
RE: constants in qtp - by elango87 - 12-07-2012, 06:21 PM
RE: constants in qtp - by elango87 - 12-07-2012, 08:59 PM
RE: constants in qtp - by diya - 12-07-2012, 10:28 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Constants shayk1985 2 3,239 12-08-2012, 12:30 AM
Last Post: shayk1985

Forum Jump:


Users browsing this thread: 1 Guest(s)