UFT Tutorial 16

UFT Class xvi (Environment Variables)
-----------------------
What are Environment Variables?
They are global variables depends on operating organization environment.
-------------------------------------
Purpose of Environment Variables
    Centralized Maintenance of Variables

    Tests portability
--------------------------------------------------
Note 1: Whenever nosotros desire to purpose whatsoever variable inward multiple Tests as well as then select Environment variables.

Note 2: Whenever you lot desire purpose whatsoever variable inward a unmarried Test as well as then no bespeak to select Environment variables.

Tests portability:

Executing Tests from unlike machines.
--------------------------------------
Types of Environment Variables
a) Built inward variables

b) User defined variables

-----------------------------
Steps:
i) Create Environment (User defined) variables as well as export to XML

ii) Associate Environment Variables file
Or
Load Environment Variables file during execution

iii) Access surroundings Variables
Syntax:
Environment("EnvironmentVariablename")

Ex:
Msgbox Environment("OS")
Msgbox Environment("ProductDir")


iv) Modify Environment variables (If required)

v) Delete Environment Variables (Optional)
---------------------------------------
Note: Environment variables are example sensitive.
-----------------------------------------------
1) Navigation for Creating Environment Variables
File menu
> Settings
> Environment
> Select variable type equally "User defined"
> Click Add icon
> Enter Variable cite as well as value
> Click OK
(Again click Add epitome if nosotros desire to utilisation multiple variables)

> Click Export

> Browse path to shop XML file

> OK
-----------------------------
2) Navigation for Associating Environment Variables file
File menu

> Settings

> Environment

> select Variable equally "User defined"

> Check "Load variables as well as values from external file"

> Browse path of the XML file

> Apply > OK
-------------------------------
Example:
SystemUtil.Run Environment("AppPath")
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set Environment("Agent")
Dialog("Login").WinEdit("Password:").Set Environment("Password")
Wait 2
Dialog("Login").WinButton("OK").Click
--------------------------------------------------------
'Load Environment Variables file during executionEnvironment.LoadFromFile "C:\Users\G C Reddy\Desktop\abcd.xml"
---------------------------------------------------------
Note: without UFT tool also nosotros tin utilisation Environment variables

> Launch Notepad

> Type tags

> Sava equally XML file
--------------------------
Tags of Environment variables file
Environment opened upwards tag halt tag

Variable opened upwards as well as unopen tag

Name opened upwards as well as unopen tag

Value opened upwards as well as unopen tag
------------------------------

Example:
<Environment>
    <Variable>
        <Name>Agent</Name>
        <Value>Chennai</Value>
    </Variable>
   
</Environment>
-------------------
 

Sumber http://www.gcreddy.com/
Post a Comment (0)
Previous Post Next Post