QA And PE

This blog discuss the various topics associated with software testing and software automation using automated tools such as QTP. You are most welcome to share topics related to software testing or comment on any topic below

Tuesday, May 12, 2009

QTP - Environment Variables

User-Defined Internal, User-Defined External, Built-in are the types of environment variables available in QTP.

Built-in variables as the name suggests are predefined by QTP. Examples of such variables are OS, OSVersion, ActionName which are for Operating System, Operating System Version and name of the action which is currently running, respectively.

Example: In the Expert View type and Run the test:
a = environment("ActionName") & " is running on " & environment("OS")
msgbox (a)

User Defined Internal variables are the variables defined by you (the user) within the test and which are saved within the test and also accessible from within the test.
Example: You may add internal enviornment variable in File (Menu)->Settings-> Environment tab.Add New Internal  Environment Parameter by selecting 'User defined' ion dropdown box. Go to expert view and type:
msgbox(environment("a"))

User-Defined external variables are the variables which are defined in the file outside of test. These act as read only for the test. You can create as many files for environment variables as you want and choose them for your test.
Open a new text file and type the following lines in it and save it with .xml extension. 
<Environment>
<Variable>
<Name> a </Name>
<Value> hello </Value>
</Variable>
</Environment>
You may attach external enviornment variable file in File (Menu)->Settings-> Environment tab. It would load Environment Parameter in XML file. Go to expert view and type:
msgbox(environment("Address"))

Labels:

0 Comments:

Post a Comment

<< Home