UFT Class 11

UFT Class 11

(Descriptive Programming Part-3, Test Methods)

Descriptive Programming / Programmatic Descriptions

Types of Descriptive Programming

a) Static Programming

Enter/Provide objects information (Properties and values) directly into statements
or steps is called Descriptive Programming.

b) Dynamic Programming

Creating description objects and generating steps / statements using description objects.

i) Step 1: Create Description Objects

Syntax:

Set Variable = Description.Create

Ex:

Set Login = Description.Create

ii) Step 2: Enter Properties information

Syntax:

DescriptionObject(“Property1Name”).Value = Property1 value
DescriptionObject(“Property2Name”).Value = Property2 value

Ex:
Login(“text”).Value = “Login”

Login(“width”).Value = 320

Login(“enabled”).Value = True

Step 3: Generate steps using description objects

Syntax:

TestObject(DescriptionObject).Method or Operation

Ex:

Dialog(Login).Activate
———————————————-
Ex:

‘Write Dynamic Descriptive Programming for Login Functionality in FR Application

‘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(“enabled”).Value = True
Login(“width”).Value = 320

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 =119

OK(“text”).Value=”OK”
OK(“width”).Value= 60

‘Generate steps 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 “54ee772c4c099a60f3d54c4fd74ee172a71f1661”
Dialog(Login).WinButton(OK).Click

UFT Test Methods

Test Methods / Operations

Method Name: Activate

Description: It activates a Dialog box or window

Syntax:

Object.Activate

Example:

Dialog(“Login”).Activate
Window(“Flight Reservation”).Activate

Method Name: Click

Description: It clicks an object(Buttons, Links)

Syntax:

Object.Click

Example:
Dialog(“Login”).WinButton(“Cancel”).Click
Browser(“Google”).Page(“Google”).Link(“Gmail”).Click

Method Name: Close

Description: It closes an object(Dialog box, window, Browser window)

Syntax:

Object.Close

Example:
Window(“Flight Reservation”).Dialog(“Open Order”).Close
Window(“Flight Reservation”).Close
Browser(“Google”).Close

Method Name: Set

Description:
a) Enter a value into Edit box
Or
b) Check/Uncheck a Check box
Or
c) Select a Radio Button

Syntax:
a) Object.Set “Value”
Or
Object.Set Parameter

b) Object.Set “ON/OFF”

Example:
Window(“Flight Reservation”).Dialog(“Open Order”).WinCheckBox(“Order No.”).Set “ON”
Window(“Flight Reservation”).Dialog(“Open Order”).WinCheckBox(“Order No.”).Set “OFF”
Window(“Flight Reservation”).Dialog(“Open Order”).WinEdit(“Edit”).Set 10
Window(“Flight Reservation”).WinRadioButton(“First”).Set

Method Name: Select

Description: It selects an item from a combo box or list box

Syntax:

Object.Select “item”
Or
Object.Select (index)

Example:
Window(“Flight Reservation”).WinComboBox(“Fly From:”).Select (0)
Window(“Flight Reservation”).WinComboBox(“Fly To:”).Select “London”
Window(“Flight Reservation”).Dialog(“Flights Table”).WinList(“From”).Select “20262 DEN 10:12 AM LON 05:23 PM AA $112.20”

Method Name: GetItemsCount

Description: It returns items count items from a combo box or list box

Syntax:

Variable = Object.GetItemsCount

Example:
Items_Count = Window(“Flight Reservation”).WinComboBox(“Fly From:”).GetItemsCount
Msgbox Items_Count

Method Name: GetContent

Description: It returns content from a combo or list box

Syntax:

Variable = Object.GetContent

Example:
Content = Window(“Flight Reservation”).WinComboBox(“Fly From:”).GetContent
Msgbox Content
————————

Method Name: SetSecure

Description: It enters encoded value into Password objects

Syntax:
Object.SetSecure “encoded value”

Example:
Browser(“Gmail”).Page(“Gmail”).WebEdit(“Passwd”).SetSecure “54ee7ee879e31f23e955e813a9101ba2843c7f00”
Dialog(“Login”).WinEdit(“Password:”).SetSecure “54ee7ef45df3be4e8b2d20eed1cd085c21bc59a46bcb”

Method Name: GetVisibleText

Description: It returns text value prom an object

Syntax:

Variable = Object.GetVisibleText

Example:
Price = Window(“Flight Reservation”).WinEdit(“Price:”).GetVisibleText()
Button = Window(“Flight Reservation”).WinButton(“Update Order”).GetVisibleText()
Msgbox Price
Msgbox Button

Method Name: GetRoProperty

Description: It returns run time object property value

Syntax:

Variable = Object.GetRoProperty(“PropertyName”)

Example:
————————
Price = Window(“Flight Reservation”).WinEdit(“Price:”).GetROProperty(“text”)
Msgbox Price

x = Window(“Flight Reservation”).WinEdit(“Price:”).GetROProperty(“enabled”)
Msgbox x

y = Window(“Flight Reservation”).WinEdit(“Price:”).GetROProperty(“width”)
Msgbox y

Method Name: CaptureBitmap

Description: It captures screen shot during test execution and stores in a specified location.

Syntax:
Object.CaptureBitmap “Path”

Example:
Dialog(“Login”).CaptureBitmap (“C:\Users\G C Reddy\Desktop\Login.bmp”)
————————
Note:
Whenever we want produce screen shots for Not reproducible defects.

Producible defect: If the defect is accruing every time
We can provide Navigation/steps

Not reproducible defect: if the defect is accruing sometimes only
We have to produce screen shots

Method Name: Sync (Only for Web)

Description: It waits for the Browser to complete its current navigation

Syntax:
Object.Sync

Example:
Browser(“Gmail”).Page(“Gmail”).Sync

Method Name: Naviagte (Only for Web)

Description: It opens a specified url in the browser window

Syntax:

Object.Navigate “URL”

Example:
Browser(“Gmail”).Navigate “www.icicibank.com”
————————

UFT
> Overview on UFT

> UFT Test Process

> UFT Tool window Arch

> Generating basic Tests
Record & Run Tests
Types of Objects
Pre-requisites
Object Repository
Keyword driven methodology
Descriptive Programming
Test Methods /Operations
—————————————
UFT Test Process
Enhancing Tests
Inserting Transaction Points (Start and End) (UFT)

Functional Test:

Login -After entering valid Agent name and password then opening next window

Performance Test:

How much time the Login operation is taking for execution
———————————————-

Note: Functional Testing is first, after successful functional testing we can go for Performance Testing

UFT Functional and Regression Test Tool, but it supports small amount of performance Testing

We can’t measure transaction time for multiple users.
————————————————-
Inserting Transaction Points for measuring Test transaction time.

Using Timer Function (VBScript Built in Function) also we can measure Test transaction time.

(31)

You may also like...

Leave a Reply