Vous êtes sur la page 1sur 2

Environment Variables :-

The variables that are commonly used across the environment in


many tests by different resources are know as Environment Variables.

There are Two types of Environment variables


1. Built-in-variables 2. User Defined Variables

1.Built-in-variables :- These variables will be by default available in every test and can be directly used
in any test with help of following syntax.
Syntax : Environment.value(“Built-in-variables”)
Example :
var=environment.Value("OS") : to display the Operating System
msgbox var

2. User Defined Variables :- The variables which are required commonly in number of test apart from
the Built-in-variables need to be created by the user which are known as User Defined Variables .
User Defined Variables are created in environment file, any body in that
environment can Associate this file and use the variables in it.

There are Two types of User Defined Variables


1. Internal User Defined Variables :- which are used in the same file
Example :
 Open the Cal application
 Put the tool under recording mode
 Capture the objects properties of Cal application to Object Repository
 Stop recording
Declaring the Environment Variables
 Activate the menu item Test
 Go to Settings
 Select the Environment tab
 Select variable type as User-defined
 Click on New button
 Add new Environment window will appear
 Give the details of Name and value ( type will be Internal )
 Click on OK
 Again Click on New button to add one more variable
 Add new Environment window will appear
 Give the details of Name and value ( type will be Internal )
 Click on OK
 Click on Apply
 Click on OK
 If you want you can Export these data to a a file with .xml extention file in the
Environment folder
Associating the Environment Variables ( by parameterizing )
 Develop the script in test pane as below
' Setting the declered environment value (a ) to value1 edit button
VbWindow("Form1").VbEdit("val1").Set environment.Value("a")
' Setting the declered environment value (b ) to value2 edit button
VbWindow("Form1").VbEdit("val2").Set environment.Value("b")
' clicking on ADD button
VbWindow("Form1").VbButton("ADD").Click
 Run the test
 Analyze the results

2. External User Defined Variables :- which are Imported from other file
Example :
 Open the Cal application
 Put the tool under recording mode
 Capture the objects properties of Cal application to Object Repository
 Stop recording
Declaring the Environment Variables
 Activate the menu item Test
 Go to Settings
 Select the Environment tab
 Select variable type as User-defined
 Select the check box of ‘load variables and values from an external file’
If you want you can make use of Exported data or you can create your own data in a file
with .xml extention file in the Environment folder
 Browse that file
 Click on Apply
 Click on OK
Associating the Environment Variables ( by parameterizing )
 Develop the script in test pane as below
' Setting the declered environment value (a ) to value1 edit button
VbWindow("Form1").VbEdit("val1").Set environment.Value("a")
' Setting the declered environment value (b ) to value2 edit button
VbWindow("Form1").VbEdit("val2").Set environment.Value("b")
' clicking on ADD button
VbWindow("Form1").VbButton("ADD").Click

 Run the test


 Analyze the results

-: The End :-
Pls. leave your feed back (both +ve and –ve ) at kanakadria@yahoo.co.in

Vous aimerez peut-être aussi