Types of Statements in UFT Test

Types of Statements in UFT Test / Test Script

1) Object Calls or Test Object Statements

Single Test Object

Syntax:

TestObject("ObjectName").Method / Operation

Ex:
Dialog("Login").Activate

Two Test Objects

Syntax:

Parent TestObject("ObjectName").Child TestObject("ObjectName").Method

Dialog("Login").WinButton("Cancel").Click

Three Test Objects

Parent TestObject("ObjectName").Child TestObject("ObjectName").Sub Chid TestObject("ObjectName").Method

Ex:
 Browser("MSN India - News, Cricket,").Page("Google").Link("Gmail").Click

2) Utility Statements
----------------------
SystemUtil.Run "C:\Program Files\HP\Unified Functional Testing\samples\flight_service\HPFlights_Service.exe" @@ hightlight id_;_Browser("MSN India - News, Cricket,").Page("Google").Link("Gmail")_;_script infofile_;_ZIP::ssf6.xml_;_

SystemUtil.Run "C:\Program Files\Internet Explorer\iexplore.exe", "www.gmail.com"

3) Declarations
-----------------
a) Variables

Dim a, b(4), c(), d(4, 5)

a= 10
b(0) = "India"
b(1) =100
b(2) =10.345
b(3) =#10/10/2010#
b(4) =123

d(0, 0) = "VBScript"

b) Constants

Const city ="London", num = 100

4) Flow Control Statements
--------------------------
a) Conditional Statements
Ex:

Dim a, b
a= 100
b= 20

If a > b Then
    Msgbox "A is a Big Number"
    Else
    Msgbox "B is a Big Number"
End If
---------------
b) Loop Statements

For i = 1 To 5 Step 1
    Msgbox i & " Hello UFT"
Next

5) Action Calls, Function Calls
--------------------------------
Ex:

Call Login()

6) Checkpoint Statements
------------------------
Window("Flight Reservation").WinEdit("Tickets:").Check CheckPoint("Tickets:")

7) Output Value Statements
-------------------------
Window("Flight Reservation").WinEdit("Name:").Output CheckPoint("Name:")

8) VBScript Statements

--------------------
Set

Dim

Constant

For

Etc....

9) Automation Objects Statements
--------------------------------

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
objExcel.ActiveWorkbook.SaveAs "C:\Users\gcreddy\Desktop\QTP.xls"

0 comments:

Post a Comment