WHAT IS ENVIRONMENT VARIABLES?

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


Please Help Members By Posting Answers For Below Questions

Explain the concept of object repository and how quicktest professional recognises objects?

563


Explain about the test fusion report of quicktest professional (qtp)?

543


Does any one worked on JIL Emulator , Testing with QTP(automation). Trail Version of QTP is not identifying the child objects of JIL emulator, Can any one help me out ,

1383


How will you handle java tree in qtp?

631


In what occasion we can specify global sheet and action sheet?

572






What is optional step in qtp? How you can add optional step in qtp?

536


Describe function procedure in vbscript.

555


Explain different type of event trigger option.

544


what kind of frame work you used in your last project?

1823


Explain actions in qtp ?

562


Whether qtp 9.0 supports Test director8.0

2124


How to use Environment parameterization? Explain with an example.

1483


What are the types of environment variables in qtp?

548


How did you resolve conflicts present in Object Repository?

1618


I used the below code to open QTP through VBscript?But i can unable to Invoke QTP...PLZ help me with the correct code to invoke QTP through VBS with description of the code aswell. Dim qtApp 'As QuickTest.Application 'Declare the Application object variable Dim qtTest 'As QuickTest.Test 'Declare a Test object variable Dim qtResultsOpt 'Declare a Run Results Options object variable Set qtApp = CreateObject("QuickTest.Application") 'Create the Application object qtApp.Launch 'Start QuickTest qtApp.Visible = False 'Make the QuickTest application visible qtApp.Open "C:\form", True 'Open the test in read-only mode 'set run settings for the test Set qtTest = qtApp.Test qtTest.Run 'Run the test 'WScript.StdOut.Write "Status is: " & qtTest.LastRunResults.Status 'Check the results of the test run qtTest.Close 'Close the test qtApp.quit 'Close QuickTest Pro Set qtResultsOpt = Nothing 'Release the Run Results Options object Set qtTest = Nothing 'Release the Test object Set qtApp = Nothing 'Release the Application object

2426