Descriptive Programming in UFT


Descriptive Programming in UFT (Programmatic Descriptions)

What is Descriptive Programming?

Enter or Provide Objects information (Properties and values of the object) directly into statements is called descriptive programming.

Advantages of Descriptive Programming:
-> Tests based on Descriptive Programming are faster in execution than Object Repository based Tests.

-> We can start Test design process even though Application is not ready.

-> Using Descriptive programming we can handle multiple instants of Application.

-> Using Descriptive programming we can handle duplicate objects.

-> Descriptive Programming is portable (we can run on different machines easily)

-> Maintenance is easy (Less amount of Resources)

Test Execution Process:
Object Repository based Test  Versus Descriptive Programming

Object Repository based Test:

During Test Execution, UFT reads statements one by one and gets objects information from Object Repository, based on that information performs operations on AUT.

Descriptive Programming:

During Test Execution, UFT reads statements one by one, Objects information also available in the statements, based on that information performs operations directly on AUT.

Note: Test object statements vary from Descriptive Programming to Object Repository based Test, remaining all statements are same.

Object Repository based Test Versus Descriptive Programming in case of Test Object Statements:

a) Single Test Object statement

OR based:

Syntax:

TestObject("Name of the Object").Method or Operation

Example:

Dialog("Login").Activate
Browser("Google").Close

DP:

Syntax:

TestObject("PropertyName:=PropertyValue").Method or Operation

Or

TestObject("Property1Name:=Property1Value", "Property2Name:=Property2Value").Method or Operation

Example:

Dialog("text:=Login").Activate
Or
Dialog("text:=Login", "width:=320","height:=204").Activate

Browser("CreationTime:=0").close

----------------------------------
Dynamic Programming- Create description objects and generate statements using description objects.
----------------------------------------------

Three steps in Dynamic Programming:
-------------------------------

i) Create Description objects


Syntax:

Set Variable = Description.Create

Example:

Set Login = Description.Create

---------------------------------------
ii) Enter one or more properties

Syntax:

Description Object("Property1 name").Value = Property1 value

Description Object("Property2 name").Value = Property2 value

Example:

Login("text").Value = "Login"
Login("width").Value = 320
Login("enabled").Value = True
-----------------------------------------------
iii) Generate statements using Description Objects

Synatx:

TestObject(descriptionObject).Method / Operation

Ex:

Dialog(Login).Activate
-------------------------------------------------------
Example:

'Create Description Objects
Set Login = Description.Create
Set Agent = Description.Create
Set Pwd = Description.Create
Set Ok = Description.Create

'Enter Properties Information

Login("text").Value ="Login"
Login("width").Value = 320
Login("height").Value = 204
Login("enabled").Value = True

Agent("attached text").value ="Agent Name:"
Agent("window id").value = 3001
Agent("x").value = 20

Pwd("attached text").value ="Password:"
Pwd("window id").value = 2000
Pwd("y").value = 123

Ok("text").Value="OK"
Ok("width").Value= 60

'Generate Statements using Description Objects
SystemUtil.Run "C:\Program Files\HP\Unified Functional Testing\samples\flight\app\flight4a.exe"
Dialog(Login).Activate
Dialog(Login).WinEdit(Agent).Set "abcd"
Dialog(Login).WinEdit(Pwd).SetSecure "53868ff62bf9c6a003e6a222cde99074e0bd01d7"
Dialog(Login).WinButton(OK).Click
------------------------------------------------------
'Generate Statements using Description Objects
ExecuteFile "Objects.vbs"
SystemUtil.Run "C:\Program Files\HP\Unified Functional Testing\samples\flight\app\flight4a.exe"
Dialog(Login).Activate
Dialog(Login).WinEdit(Agent).Set "abcd"
Dialog(Login).WinEdit(Pwd).SetSecure "53868ff62bf9c6a003e6a222cde99074e0bd01d7"
Dialog(Login).WinButton(OK).Click

1 comments:

Post a Comment