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:
Post a Comment