Test methods in UFT


Test methods in UFT
-----------------------------------------------
Method Name: Activate

Description: it activates a dialog box or window

Syntax:

Object Hierarchy.Activate

Example:

Dialog("Loging").Activate

Window("Flight Reservation").Activate
-----------------------------------------------

Method Name: Click

Description: It clicks an Object Hierarchy (Buttons, Links)

Syntax:

Object Hierarchy.Click

Example:

Dialog("Login").WinButton("Cancel").Click @@ hightlight id_;_68412_;_script infofile_;_ZIP::ssf2.xml_;_
Browser("Google").Page("Google").Link("Gmail").Click
-----------------------------------------------
Method Name: Close

Description: It closes an Object Hierarchy (Dialog, window, Browser window)

Syntax:

Object Hierarchy.close

Example:
Browser("Google").Close
Window("Flight Reservation").Dialog("Open Order").Close
Window("Flight Reservation").Close
-----------------------------------------------
Method Name: Set

a) Enters data into edit box

Object Hierarchy.Set "value"

Or

Object Hierarchy.Set Parameter
-----------------------------------------------
b) Check or uncheck a check box

Object Hierarchy.Set "ON/Off"

c) Selects a Radio Button

Object Hierarchy.set

Examples:

Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON" @@ hightlight id_;_199380_;_script infofile_;_ZIP::ssf7.xml_;_
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set "10" @@ hightlight id_;_199382_;_script infofile_;_ZIP::ssf8.xml_;_
Window("Flight Reservation").WinRadioButton("First").Set
-----------------------------------------------
Method Name: SetSecure

Description: It enters encoded value into Password Object Hierarchy

Syntax:

Object Hierarchy.SetSecure "Encoded value"

Example:
Browser("Google").Page("Gmail").WebEdit("Passwd").SetSecure "5387d4821300d7832e254883a36146d7378cce501c47d18c7823" @@ hightlight id_;_Browser("Google").Page("Gmail").WebEdit("Passwd")_;_script infofile_;_ZIP::ssf11.xml_;_
Dialog("Login").WinEdit("Password:").SetSecure "5387d497c973a681764f2771e3724a2e6c0d6b2e" @@ hightlight id_;_199526_;_script infofile_;_ZIP::ssf14.xml_;_

-----------------------------------------------
Method Name: Select

Description: Selects an item from a combo box or list box

Syntax:

Object Hierarchy.Select "Item"

Or

Object Hierarchy.Select (index)

Example:

Window("Flight Reservation").WinComboBox("Fly From:").Select (0) @@ hightlight id_;_461630_;_script infofile_;_ZIP::ssf16.xml_;_
Window("Flight Reservation").WinComboBox("Fly To:").Select "London" @@ hightlight id_;_592614_;_script infofile_;_ZIP::ssf17.xml_;_
Window("Flight Reservation").Dialog("Flights Table").WinList("From").Select "20262   DEN   10:12 AM   LON   05:23 PM   AA     $112.20" @@ hightlight id_;_396026_;_script infofile_;_ZIP::ssf19.xml_;_
-----------------------------------------------
Method Name: GetVisibleText

Description: it captures text value from an Object Hierarchy

Syntax:

Variable = Object Hierarchy.GetVisibleText

Example:

Total = Window("Flight Reservation").WinEdit("Total:").GetVisibleText() @@ hightlight id_;__;_script infofile_;_ZIP::ssf26.xml_;_
Button = Window("Flight Reservation").WinButton("Update Order").GetVisibleText() @@ hightlight id_;__;_script infofile_;_ZIP::ssf27.xml_;_

Msgbox Total
Msgbox Button
-----------------------------------------------
Generate Non-Recordable statements:


i) Using Step Generator

Or
ii) Add Object Hierarchy to Object Hierarchy Repository and type the statement

-----------------------------------------------
Method Name: GetRoProperty

Description: It returns run time Object Hierarchy property value

Syntax:

Variable = Object Hierarchy.GetRoproperty("PropertyName")

Example:

Total = Window("Flight Reservation").WinEdit("Total:").GetROProperty("text") @@ hightlight id_;__;_script infofile_;_ZIP::ssf5.xml_;_
Msgbox "Totail is: "& Total

x = Window("Flight Reservation").WinEdit("Total:").GetROProperty("enabled") @@ hightlight id_;__;_script infofile_;_ZIP::ssf5.xml_;_
Msgbox "Enabled is: " & x

y = Window("Flight Reservation").WinEdit("Total:").GetROProperty("width") @@ hightlight id_;__;_script infofile_;_ZIP::ssf5.xml_;_
Msgbox "Width is: " & y
-----------------------------------------------

GetVisibleText    Vs    GetRoProperty

GetVisibleText method only for returning text value from an Object Hierarchy

GetRoProperty method can return any property value from an Object Hierarchy
-----------------------------------------------
Method Name: GetItemsCount

Description: Returns items count from a Combo box or list box

Syntax:

Variable = Object Hierarchy.GetItemesCount

Example:

x = Window("Flight Reservation").WinComboBox("Fly From:").GetItemsCount @@ hightlight id_;_461630_;_script infofile_;_ZIP::ssf3.xml_;_
Msgbox x

-----------------------------------------------
Method Name: GetContent

Description: Retuns content from a combox or list box

Syntax:

Variable = Object Hierarchy.GetContent

Example:
x = Window("Flight Reservation").WinComboBox("Fly From:").GetContent @@ hightlight id_;_461630_;_script infofile_;_ZIP::ssf3.xml_;_
Msgbox x
-----------------------------------------------
Method Name: Sync (Only for Web)

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

Syntax:

Object Hierarchy.Sync

Example:
Browser("Google").Page("Google").Sync
-----------------------------------------------
Method Name: Navigate (Only for Web)

Description: It opens a specified URL in the Browser window

Syntax:

Object Hierarchy.Navigate "url"

Example:
Browser("Google").Navigate "http://www.gcreddy.com/"
-----------------------------------------------
Method Name: CaptureBitmap

Description: captures screenshot during execution and stores in a specified location.

Syntax:

Object Hierarchy.CaptureBitMap "Path"

Example:
Dialog("Login").CaptureBitmap "C:\Documents and Settings\G C Reddy\Desktop\Login.bmp"
-----------------------------------------------

0 comments:

Post a Comment