UFT Class 8
(Types of Statements inwards UFT Test)
Advantages of Recording
a) Easy to generate Tests in addition to It is fast
b) Scripting cognition is optional
c) It is used to analyze the AUT inwards damage of object Identification
d) It is recommended for curt term projects
e) It is recommended for dynamically changing UI designs
------------------------------------------
Disadvantages of Recording
a) No centralized maintenance of Test Objects
b) Low inwards performance
c) Less or no concentration on complex functionality testing
d) Testers may non convey ascendancy on Tests in addition to thence locating errors is difficult
e) All types of exam object statements can't endure recorded
ex: Irregular operations in addition to Operations on disabled objects.
-------------------------------------------------------------------
Types of statements inwards UFT Test
--------------------------------
We usage dissimilar types of statements inwards 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"
--------------------------------------------------
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 usage conditional statements to insert verification points in addition to for Error handling.
v) Loop Statements
For i = 1 To v 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
-----------------------------------------------