Environment Parameters in QTP 9.2

Environment parameters deal with the environment where quick test is installed.

Environment variables are of two types:

1. Built In Environment Variables
2. User Defined Environment Variables.

Built in Environment variables are created when QTP is installed and they are read only.

User Defined Environment variables are of two types:

1. Internal Variables.
2. External Variables.


Internal variables are defined in QTP by navigating to File, Settings, Test Settings, Environment, Select User Defined from the Variable Type Combo Box. Click the + sign and you will be displayed a dialog box “Add New Environment Parameter”. Enter the name and Value and click OK. You will see that the newly created variable is listed and it is an internal type. Look at the image below.


External Variables are those which are defined in an external xml file and then loaded into the current Test by selecting the check box of “Load variables and values from external file” and brows the path of the xml file and click ok. The variables are loaded and you can see the type as External. Look at the image below


If there is a need to create a environment variable we define it in a xml file and load it as user defined environment variable. All the environment variables are listed in Test Settings.

Environment Object is an utility object in QTP that deals with the Quick Test Environment.

Value Property is used to set or retrieve values of environment parameters.

Environment object enables you to work with environment variables. You can retrieve the value of any environment variable. You can set the value of only user defined environment variables.

Syntax:

Environment.Value(VariableName)

Print Environment.Value(“OS”)

This will fetch the value of the Operating system on which QTP is installed and print it for the user as “Microsoft Windows XP Workstation”

1 comments:

Anonymous said...

Thanks for the useful information.
Can you please explain how to convert Input Parameters (e.g. in Excel Data sheet) into Environment Variables?

So that these parameters can be accessed Globally.

Post a Comment

/* Tynt Insight tracker ----------------------------------------------- */