Saturday, May 31, 2008

Environment Variables

Environment variables helps us to use the variables from other sources during the run session.

Types of Environment Variable:

1. User defined Internal - These variables are saved with in the test and accessible only with in the test in which they were defined.
2. User defined External - We can use external environment variables from any other program.
Example for User Defined Environment Variables is Email, FirstName,LastName, PhoneNumber, etc..
3. Built In - It enables you to know the current information about the test and computer on which the test is run. These variables are accessible from all test and components. They are read only.
Example for Built In Environment Variable is OperatingSystem, OSVersion, LocalHostName, ProductName, ProductVersion, etc..

By default, Environment variables are internal type that means we cannot use that internal environment variables from any other program. That's why we can make it as external variables.

Deference between Built In and User Defined Environment Variables -

We cannot create or modified the values for built in environment variables. But we can create and modify the values for user-defined environment variables.

Use of Environment variable -

Environment variable comes into picture when we try to parameterize data.
It is one kind of data source.
When we want to test an application, where the user interface string changes, depending on the selected language.
We can use external environment variables from any other program by loading xml file.
Ex: Environment.LoadFromFile"Path of the xml file"

To check whether it is exist or not -

By using "Environment("ParamterName").value" we can know that variable exist in the environment.
By using "Environment.value("ParameterName")" then QTP will create a new internal environment variable if does not exists already.




No comments:

About Me

My photo
Hi all,I am Arun Singh Rajaputra. I am working as a Project Lead in a reputed organization in Hyderabad, AP, India. I have little bit knowledge on Quick Test Professional and like to share my knowledge to all through this blog.

Subscribe to get updates on this blog

Enter your email address:

NOTE

Some of the posts posted in this blog are collected and most of them have been prepared by me. If any one have objections regarding any copied posts. Please mail me so that I can take a necessary action on that post.