UFT Class 8

UFT Class 8

(Types of Statements in UFT Test)

Advantages of Recording

a) Easy to generate Tests and It is fast

b) Scripting knowledge is optional

c) It is used to analyze the AUT in terms of object Identification

d) It is recommended for short term projects

e) It is recommended for dynamically changing UI designs

Disadvantages of Recording

a) No centralized maintenance of Test Objects

b) Low in performance

c) Less or no concentration on complex functionality testing

d) Testers may not have command on Tests so locating errors is difficult

e) All types of test object statements can’t be recorded

ex: Irregular operations and Operations on disabled objects.

Types of statements in UFT Test

We use different types of statements in our tests.

i) Declaration Statements

a) Variables

Ex:
Dim a, b(3), c(), d(4, 5)

b) Constants

Const city=”London”, num=100, x = #10/10/2010#

ii) Utility statements

Ex:
SystemUtil.Run “C:\Program Files\HP\Unified Functional Testing\samples\flight\app\flight4a.exe”
SystemUtil.Run “C:\Program Files\Internet Explorer\iexplore.exe”, “www.gmail.com”

RepositoriesCollection.Add “D:\Login.tsr”

Types of UMT Statements

iii) Test Object Statements

a) Single Test Object statement

Syntax:

TestObject(“ObjectName”).Method /Operation

Ex:

Dialog(“Login”).Activate

Browser(“Gmail”).Close

b) Two Test object statements

Syntax:

TestObject(“ObjectName”).Child TestObject(“Objectname”).Method /Operation

Example:

Dialog(“Login”).WinButton(“Cancel”).Click

Browser(“Google”).Page(“Google”).Sync

c) Three Test objects statement

Syntax:

TestObject(“ObjectName”).Child TestObject(“ObjectName”).Sub-Child TestObject(“Objectname”).Operation

Ex:

Window(“Flight Reservation”).Dialog(“Open Order”).WinButton(“Cancel”).Click

Browser(“Gmail”).Page(“Gmail”).Link(“Create an account”).Click

iv) Conditional statements

Ex:
Dim a, b
a = 100
b = 50

If a > b Then
Msgbox “A is a Big Number”
Else
Msgbox “B is a Big Number”
End If

Note: We use conditional statements to insert verification points and for Error handling.

v) Loop Statements

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

vi) Automation object statements

Set objFso = CreateObject(“Scripting.FileSystemObject”)
objFso.CreateFolder “C:\Users\G C Reddy\Desktop\UFT”

vii) Checkpoint statements

Window(“Flight Reservation”).WinEdit(“Tickets:”).Check CheckPoint(“Tickets:”)

viii) Output value statement

Window(“Flight Reservation”).WinEdit(“Name:”).Output CheckPoint(“Name:”)

ix) VBScript Statements

ex:
Dim
With
set
For
Option Explicit
On Error Resume Next etc…

Ex:
Set x = Dialog(“Login”)
x.Activate
x.WinEdit(“Agent Name:”).Set “abcd”
x.WinEdit(“Password:”).SetSecure “54ebda121556ea2ddf1d0c77a6ddd6839ca748ee” x.WinButton(“OK”).Click

x) Function Calls, Action Calls

Ex:
Call Login(“abcd”, “mercury”)

RunAction “Login [GUITest4]”, oneIteration
———————————————–

Follow me on social media: