Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to Initialize Environment Variable
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
Well in this case u can bring a concept of .xml file which will be used as common environment variable. Just create "a.xml", initialize the environment variable there in following format---

Code:
<Environment>
        <Variable>
        <Name>Test123</Name>
        <Value>Enter value here</Value>
    </Variable>
</Environment>


Now call this environment variable in your function library like following by its name,this will be accessed by all scripts--

Environment.Value("Test123") ---this will return u --"Enter value here" in function library...

Now its the most important part...
Open your test (From which u called that function) in QTP and go to File-->Settings-->Environment Tab-->Select USER DEFINED from drop down-->Check the checkbox "Load Variable......"-->browse that particular xml file. and click ok.

now you are done...now u can access that environment variable from your script through function. Whenever your script will call "Function x" where that environment value is accessed, just load this xml file with that script from which you want to call that function which are accessing that environment variable....


Hope i am clear to u....if there is any doubt, just drop me a mail in souvikghosh.diatm@gmail.com...because i often check these replies...
Reply


Messages In This Thread
RE: how to Initialize Environment Variable - by souvikghosh_diatm - 06-27-2011, 04:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to retrieve ArrayList saved in Environment Variable Gautam26 8 4,725 11-07-2013, 08:26 PM
Last Post: ssvali
  C# Environment property using QTP API asuteau 0 3,978 08-03-2012, 06:51 PM
Last Post: asuteau
  Array as User-Defined Environment Variables Arena 3 4,265 04-16-2012, 09:19 AM
Last Post: sshukla12
  programming to use different external file of environment variables bundfromnj 1 3,959 01-19-2012, 05:32 PM
Last Post: SteveS
  how can I store a string with variable in it, in another variable? reejais 4 4,601 11-11-2010, 11:46 PM
Last Post: smeepaga

Forum Jump:


Users browsing this thread: 1 Guest(s)