In notepad File we can write 

<Environment>
<Variable>
<Name>user1</Name>
<Value>sandeep</Value>
</Variable>
<Variable>
<Name>user2</Name>
<Value>mercury</Value>
</Variable>
</Environment>

above code you can save as testdata.xml in notepad file

after that you have 2 types to run above varibles in QTP script


1) 

Open QTP window

File -> settings -> Environment -> user-defined -> check the Load variables 
and values from external file -> Browse where we can save the file -> 
select the file -> apply -> save

after please see the bellow code
systemutil.run "C:\Program Files\HP\QuickTest 
Professional\samples\flight\app\flight4a.exe"
a= environment.Value("user1")   'user1 is the case sensitive 
b= environment.Value("user2")

Dialog("title:=Login").WinEdit("attached text:=Agent Name:").Set a
Dialog("title:=Login").WinEdit("attached text:=Password:").Set b
Dialog("title:=Login").WinButton("text:=OK").Click


2)

In QTP script first
Environment.Loadfromfile("file path")   'here we dont need to assign the 
values or load file

*same script for above* 


Regards
Sandeep G

On Thursday, 2 January 2014 15:38:07 UTC+5:30, ravi wrote:
>
> Hi QTP Experts,
>
> in one of the forum i saw , the solution for the above was given below
> *http://www.allinterview.com/showanswers/102690.html 
> <http://www.allinterview.com/showanswers/102690.html>*
>
> # 1 <http://www.allinterview.com/viewpost/234062.html> using environment 
> variable
> you can write XML script to define environment variable in
> notepad and save it as XML file.and when u executing qtp
> main script call this environment variable.  
>
> can anyone give clear picture of the solution suggested.
>
> regards,
> ravi 
>

-- 
-- 
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en

--- 
You received this message because you are subscribed to the Google Groups "QTP 
- HP Quick Test Professional - Automated Software Testing" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to