Subscribe by Email

Wednesday, September 19, 2012

What are the types of environment variables in QTP?

The quick test professional comes with a whole lot of environment variables and under many types. In this article we are going to discuss about the same but first let us focus what actually these environment variables are. 

What are Environment Variables

- The environment variables have come to be termed as “dynamic named values” which have the ability to affect the way the processes behave on a computer system while in execution phase.
- With the environment variables an operating environment is created in which the applications or processes are supposed to run. 

We give an example to make it easy for you to understand the concept of environment variables:
- Suppose a particular system uses a particular location for storing its temporary files. 
- This location can be designated with an environment variable having a standard name. 
- This location may differ from computer to computer. 
- This environment variable can be accessed by any of the processes using the standard name assigned to it. 
- This mechanism makes sure that the process stores the temporary files in a directory or a folder that surely exists and has sufficient place for storing the data. 
- In systems having UNIX or UNIX like operating systems each process is provided with its own set of environment variables.

More about Environment Variables
- Whenever a process is created from its parent process a duplicate environment of the parent process is inherited by the child process by default. - However, the explicit changes are not inherited. 
- From command shells, the environment variables can be changed by the user by an indirect invocation or by using the below stated notation:
- Even the operating systems like MS- DOS, Microsoft windows etc come with environment variables. 
- However, all of these do not make use of the exact same environment variables. 
- For the purpose of configuration, the values of these environment variables can be used by the running processes. 
- Below we are stating some common examples of the environment variables:
  1. HOME
  3. PATH
  4. TERM
  5. MAIL
  6. TEMP
- For the batch files as well as the shell scripts the environment variables serve the purpose of communicating the preferences to child processes and data. 

Environment Variables in QTP

Now we shall see the concept of environment variables in quick test professional. 
- In quick test professional the environment variables are more like global variables which can be accessed by any part of the test script.
- The values of the environment do not change by any number of the iterations but yes they can be changed by modifying them in the script. 
- The basic advantage of the environment variables is that they can be used or shared across several reusable actions. 
- 2 types of environment variables have been defined namely:
  1. Built in environment variables and
  2. User defined environment variables.
- The first type of the environment variables defines the internal variables that are a property of quick test professional and hold valuable information like path of the folders, name of iteration, and version of the operating system and so on.
- The user defined environment variables can be further defined in to 2 types namely:
  1. User defined internal: variables defined within the test and accessible only within the test and
  2. User defined external: Variables predefined in the external environment variable file.
Below mentioned are the built in environment variables in quick test professional:
  1. ActionName
  2. ActionIteration
  3. OS
  4. OSversion
  5. ProductName
  6. ProductVer
  7. ResultDir
  8. TestDir
  9. UserName
  10. TestName
  11. UpdatingActiveScreen
  12. UpdatingCheckPoints
  13. GroupName
  14. ScenarioID
To get the values from the environment variables during the run time you should know the path of the folder where the test is located. 

No comments:

Facebook activity