Answer Posted / deven
Environment variables in QTP are similar to global
variables which can be accessed through any part of the
script.These variables can prove to be very useful when we
want a variable to be shared across various reusable
actions and functions.
Two Types of Environment variable:
1. Built in variables
2. User Defined variables
♦ Internal
♦ External
Built in variable:
Built-in: Variables that represent information about the
test on which the test is run, such as Test path and
Operating system. These variables are accessible from all
tests, and are designated as read-only.
Syntax:
Variable = Environment("environment variable name")
Example:
'Some of the In built Environment Variables
Msgbox Environment("OS")
Msgbox Environment("OSVersion")
Msgbox Environment.value("ProductDir")
Msgbox Environment.value("ProductName")
'path where Test result for the current test is stored
Msgbox Environment("ResultDir")
Internal User defined variable:
User defined Internal: are the variables that we define
within the test.The variables are saved with the test and
are accessible only within the test.
Example:
'User can create their own enviroment variables like "Url"
Environment.Value("Url")= "http:\\www.gmail.com"
URL=Environment.Value("Url")
Systemutil.Run "iexplore.exe",URL
External User defined variable
User defined External: are the variables that we predefine
in the active external environment variables file.These can
be created using a list of variable-value pairs in an
external file in .xml format.
Steps to follow:
1. Create External user defined variable
File --> settings --> Environment --> select variable type
as user defined --> click add icon (+) --> enter variable
name & Value --> click OK --> click export --> browse path
and enter file name --> save with xml extension --> click
OK.
2. Associate environment variable file(xml)
File --> settings -->Environment --> select variable type
as user defined --> check “load variables and values from
the external file” --> browse path of the xml file -->
click apply --> Click OK.
XML file with variable name and value should be mentioned
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How many types of object repository in qtp?
Hi, I am using OutputCheckPoint for 2 webelements Bed:4 and Bath:2 Full,1 partial in my result page and I am storing the value in the data table. I dont need the string Bed:4,I would like to get only the no 4. How can I get it? Even though I highlight only 4,It is seleting the full value "bed 4". Same thing happend for second webelement Bath:2 Full,1 partial I need only the No 2. I used the following to split MyArray = Split(UIBathResult, " ", -1, 1) But it is giving the value My Array(0)=Bath:2full,1Partial I need the only the nos for further comparision.Any help? Thanks Uma
i have asked earlier only one question how to test web application using QTp plz send me the answer quickly
What is the virtual object?
1.Write a CRITICAL test cases for calculator ? 2.What is the difference b/w FRS and SRS documents ? 3.What is Component ? 4.What is object ? 5.what is the difference b/w static and dynamic descriptive programming ?
explain keyword driven framework with banking domain?
What is a programmatic description?
What is the significance of “action 0” in qtp?
They asked by using qtp recording writing scripting
Why do we use breakpoints in QTP?
Can any one tell me how to write a script for selecting open option in File menu of A word document.here you have to add objects to OR.try like that and give me the ans.i asked this question to so many but no one knows.if any one know the answer plz let me know
What is ‘object spy’ and what is the function of object spy in qtp?
What the differences are and best practical application of Object Repository?
Will there be any standards or requirements for page appearance and/or graphics throughout a site or parts of a site?
how to write the descriptive programming in QTP for remove the object value and substitute, with a variable then call the validation from excel