Feb 27, 2015

UFT Tutorial 13

UFT Class 13 (Parameterization)
----------------
What is Parameterization?

Replacing constant (Fixed) values with parameter is called Parameterization.
-----------------------------------------------
Purpose of Parameterization

    Passing single value but different value every time

    Passing multiple values.
----------------------------------------------
What is Data Driven Testing?

Testing the same functionality using multiple sets of Test Data.
---------------------------------------
Why Data Driven Testing?

    For Negative Testing
    For checking the reliability of the System.
----------------------------------------
Relation between Parameterization and Data driven Testing

    We use Parameterization feature in Data driven Testing.

Data Driven Testing means passing multiple values only.

Parameterization means not only passing multiple values also passing single value.
-----------------------------------------------------------
How to Parameterize?

We can use either Variables or Constants or Arguments or Environment variables
or Data Table parameters or Action parameters or Dictionary keys as Parameters.

Generally, If it is Test Level we prefer variables, Function level we prefer Arguments.
-----------------------------------------------
Ways of Parameterization
------------------------------------
i) Generate and Pass values using Loop statements

ii) Dynamic submission of Test Data

iii) Using Data Table Parameters
    a) Enter test data directly into Data Table and connect to the Test.
    b) Import test data from external files (text/excel) and connect to the test.
    c) Import test data from a database and connect to the test.
    d) Use Data Table methods and programmatic statements.

iv) Using Environment variables

v) Using Action Parameters

vi) Using Function Arguments

vii) Using Dictionary object (Keys)

viii) Using Automation objects
    a) Read data directly from a text file and connect data (Filesystem object)
    b) Read data directly from an excel file and connect data (Excel Application object)
    c) Read data directly from a database and connect data (Database Objects)
-------------------------------------------------
i) Generate and Pass values using Loop statements

a) We can generate Sequential numbers (1, 2, 3......)
b) We can generate Logical numbers (2, 4, 6....10, 20, 30....)

Limitations:

we can't desired numbers (1, 7, 34, 56.....)

We can't generate string type data (User name, Password, city name etc....)
------------------------------------------
'Open 1 to 5 records
For OrderNumber = 1 To 5 Step 1
Window("Flight Reservation").Activate @@ hightlight id_;_263052_;_script infofile_;_ZIP::ssf1.xml_;_
Window("Flight Reservation").WinButton("Button").Click @@ hightlight id_;_1246396_;_script infofile_;_ZIP::ssf2.xml_;_
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON" @@ hightlight id_;_590908_;_script infofile_;_ZIP::ssf3.xml_;_
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set OrderNumber @@ hightlight id_;_786464_;_script infofile_;_ZIP::ssf4.xml_;_
wait 2
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click @@ hightlight id_;_1508614_;_script infofile_;_ZIP::ssf5.xml_;_
Next
---------------------------------------
'Open even numbers up to 10
For OrderNumber = 2 To 10 Step 2
Window("Flight Reservation").Activate @@ hightlight id_;_263052_;_script infofile_;_ZIP::ssf1.xml_;_
Window("Flight Reservation").WinButton("Button").Click @@ hightlight id_;_1246396_;_script infofile_;_ZIP::ssf2.xml_;_
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON" @@ hightlight id_;_590908_;_script infofile_;_ZIP::ssf3.xml_;_
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set OrderNumber @@ hightlight id_;_786464_;_script infofile_;_ZIP::ssf4.xml_;_
wait 2
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click @@ hightlight id_;_1508614_;_script infofile_;_ZIP::ssf5.xml_;_
Next
-------------------------------------
'Open first 5 orders in reverse order
For OrderNumber = 5 To 1 Step -1
Window("Flight Reservation").Activate @@ hightlight id_;_263052_;_script infofile_;_ZIP::ssf1.xml_;_
Window("Flight Reservation").WinButton("Button").Click @@ hightlight id_;_1246396_;_script infofile_;_ZIP::ssf2.xml_;_
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON" @@ hightlight id_;_590908_;_script infofile_;_ZIP::ssf3.xml_;_
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set OrderNumber @@ hightlight id_;_786464_;_script infofile_;_ZIP::ssf4.xml_;_
wait 2
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click @@ hightlight id_;_1508614_;_script infofile_;_ZIP::ssf5.xml_;_
Next
------------------------------------
'Open first 5 orders except 4th order
For OrderNumber = 1 To 5 Step 1
If OrderNumber <> 4 Then
Window("Flight Reservation").Activate @@ hightlight id_;_263052_;_script infofile_;_ZIP::ssf1.xml_;_
Window("Flight Reservation").WinButton("Button").Click @@ hightlight id_;_1246396_;_script infofile_;_ZIP::ssf2.xml_;_
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON" @@ hightlight id_;_590908_;_script infofile_;_ZIP::ssf3.xml_;_
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set OrderNumber @@ hightlight id_;_786464_;_script infofile_;_ZIP::ssf4.xml_;_
wait 2
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click @@ hightlight id_;_1508614_;_script infofile_;_ZIP::ssf5.xml_;_
End If
Next
-------------------------------------------------
ii) Dynamic Submission of Test Data

> No resource (Test data file) is required, but not recommendable for large amount of test data.

> User interaction is mandatory for every test iteration.

Ex:
For i = 1 To 3 Step 1
Agent = InputBox("Enter Agent Name")
Password = InputBox ("Enter Password")
SystemUtil.Run "C:\Program Files\HP\Unified Functional Testing\samples\flight\app\flight4a.exe","","C:\Program Files\HP\Unified Functional Testing\samples\flight\app\",""
Dialog("Login").Activate @@ hightlight id_;_786462_;_script infofile_;_ZIP::ssf1.xml_;_
Dialog("Login").WinEdit("Agent Name:").Set Agent @@ hightlight id_;_1508556_;_script infofile_;_ZIP::ssf2.xml_;_
Dialog("Login").WinEdit("Password:").Set Password @@ hightlight id_;_853046_;_script infofile_;_ZIP::ssf3.xml_;_
Wait 2
Dialog("Login").WinButton("OK").Click @@ hightlight id_;_1442954_;_script infofile_;_ZIP::ssf4.xml_;_
Window("Flight Reservation").Close
Next
---------------------------------
It is used to submit captcha fields.
----------------------------------
iii) Using Data Table Parameters

> It is an integrated spread sheet for Data related operations.

Navigation:

View menu -> Data

> Data table has 2 types of sheets

a) Global sheet

b) Action sheets (Local sheets)

> Data Table located in 2 areas:

a) In UFT Tool main window (Design time Data table)

b) In UFT Tool Result window (Run-time Data Table)

> Usage of Data Table
------------------------------------------------
Steps for Data Driven Testing using Data table

a) Generate the basic Test and run it once.

b) Launch Data table and enter or Import Test data.

c) Connect test data to the Test.

    Using editor view Or Using Keyword view or Using Data Driver

d) Run the Test
-------------------------------------------

UFT Tutorial 12



UFT Class 12 (Measuring Test Transaction Time)
----------------------------
UFT Test Process
                Enhancing Tests 
Inserting Transaction Points (Start and End)

Using Inserting Transaction Points we can measure Test Transaction.

We can measure entire Test transaction Time and Part of the Test Transaction Time.

We can insert multiple transaction points in a Test.

Services Utility object

Syntax:

Services.StartTransaction "TransactionName"
Statements
-----------
-----------
-----------
Services.EndTransaction "TransactionName"
---------------------------------------
Functional Test Result Analysis                  Performance Test Result Analysis
-------------------------------------------------------------------------
Input: 3, 5                                                       Login for 1000 Users
Operation: Addition

Expected: 8                                                        Expected: 5 second

Actual:                                                                Actual:

Considerable Factor: AUT only                             AUT
                                                                        Server response
                                                                         Local system configuration
                                                                          Network communicators  ------------------------------------------------------------------
Example:
Services.StartTransaction "Orders"
Services.StartTransaction "Login"
SystemUtil.Run "C:\Program Files\HP\Unified Functional Testing\samples\flight\app\flight4a.exe","","C:\Program Files\HP\Unified Functional Testing\samples\flight\app\",""
Dialog("Login").Activate @@ hightlight id_;_656368_;_script infofile_;_ZIP::ssf1.xml_;_
Dialog("Login").WinEdit("Agent Name:").Set "asdf" @@ hightlight id_;_66684_;_script infofile_;_ZIP::ssf2.xml_;_
Dialog("Login").WinEdit("Password:").SetSecure "54f06ce21ecc08d32bb26b7ca4252783e5711755" @@ hightlight id_;_66686_;_script infofile_;_ZIP::ssf3.xml_;_
Dialog("Login").WinButton("OK").Click @@ hightlight id_;_66688_;_script infofile_;_ZIP::ssf4.xml_;_
Window("Flight Reservation").Activate @@ hightlight id_;_721904_;_script infofile_;_ZIP::ssf5.xml_;_
Services.EndTransaction "Login"
Window("Flight Reservation").WinButton("Button").Click @@ hightlight id_;_66764_;_script infofile_;_ZIP::ssf6.xml_;_
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON" @@ hightlight id_;_66788_;_script infofile_;_ZIP::ssf7.xml_;_
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set "1" @@ hightlight id_;_66790_;_script infofile_;_ZIP::ssf8.xml_;_
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click @@ hightlight id_;_66792_;_script infofile_;_ZIP::ssf9.xml_;_
Window("Flight Reservation").WinMenu("Menu").Select "File;Fax Order..."
Window("Flight Reservation").Dialog("Fax Order No. 1").Activate @@ hightlight id_;_263388_;_script infofile_;_ZIP::ssf10.xml_;_
Window("Flight Reservation").Dialog("Fax Order No. 1").ActiveX("MaskEdBox").Type "11111111111" @@ hightlight id_;_66848_;_script infofile_;_ZIP::ssf11.xml_;_
Window("Flight Reservation").Dialog("Fax Order No. 1").WinButton("Send").Click @@ hightlight id_;_132330_;_script infofile_;_ZIP::ssf12.xml_;_
Window("Flight Reservation").Close
Services.EndTransaction "Orders"
-----------------------------------------
Transaction points export the value to UFT Result window only.

We can't display the value locally and it can't be exported to external files.
-----------------------------------
Using Timer Function (VBScript Built in Function) we can measure Test transaction Time.

It returns time in seconds that have elapsed since 12:00 AM (Midnight) based
on local system.

Usage:                  1:00 (3600)         

Variable1 = Timer (3600)
Statements
---------
-----------
---------
----------
Variable2 = Timer(3618)
Variable3 = Variable2 - Variable1 (3618-3600)
------------------------------------
Define Test Result:
---------------------
Scenario 1:

UFT provides Test Result for every Test iteration if we use UFT tool
features like Checkpoints, Output values, Transaction points etc...

scenario 2:

If we use our own logic then we need to define Test Result.
-----------------------------------
How to define Test Result:

Using Reporter Utility object we can define Test result.

ex:
Start_Transaction = Timer
SystemUtil.Run "C:\Program Files\HP\Unified Functional Testing\samples\flight\app\flight4a.exe","","C:\Program Files\HP\Unified Functional Testing\samples\flight\app\",""
Dialog("Login").Activate @@ hightlight id_;_656368_;_script infofile_;_ZIP::ssf1.xml_;_
Dialog("Login").WinEdit("Agent Name:").Set "asdf" @@ hightlight id_;_66684_;_script infofile_;_ZIP::ssf2.xml_;_
Dialog("Login").WinEdit("Password:").SetSecure "54f06ce21ecc08d32bb26b7ca4252783e5711755" @@ hightlight id_;_66686_;_script infofile_;_ZIP::ssf3.xml_;_
Dialog("Login").WinButton("OK").Click @@ hightlight id_;_66688_;_script infofile_;_ZIP::ssf4.xml_;_
Window("Flight Reservation").Activate @@ hightlight id_;_721904_;_script infofile_;_ZIP::ssf5.xml_;_
Window("Flight Reservation").WinButton("Button").Click @@ hightlight id_;_66764_;_script infofile_;_ZIP::ssf6.xml_;_
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON" @@ hightlight id_;_66788_;_script infofile_;_ZIP::ssf7.xml_;_
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set "1" @@ hightlight id_;_66790_;_script infofile_;_ZIP::ssf8.xml_;_
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click @@ hightlight id_;_66792_;_script infofile_;_ZIP::ssf9.xml_;_
Window("Flight Reservation").WinMenu("Menu").Select "File;Fax Order..."
Window("Flight Reservation").Dialog("Fax Order No. 1").Activate @@ hightlight id_;_263388_;_script infofile_;_ZIP::ssf10.xml_;_
Window("Flight Reservation").Dialog("Fax Order No. 1").ActiveX("MaskEdBox").Type "1111111111" @@ hightlight id_;_66848_;_script infofile_;_ZIP::ssf11.xml_;_
Window("Flight Reservation").Dialog("Fax Order No. 1").WinButton("Send").Click @@ hightlight id_;_132330_;_script infofile_;_ZIP::ssf12.xml_;_
Window("Flight Reservation").Close
End_Transaction = Timer
TransactionTime = End_Transaction - Start_Transaction
Msgbox TransactionTime
Reporter.ReportEvent 2, "Res1", "Transaction Time is: "& TransactionTime
------------------------------
Reporter -Utility object

ReportEvent- Method or Operation

2 - Result Status

                Either micPass or 0 for Pass status
                Either micFail or 1 for Fail Status
                Either micDone or 2 for Done status
                Either micWarning 3 for Warning Status

"Res1" - Result step name

"Transaction Time is: " -Details

& Concatenation operator

TransactionTime - Variable
------------------------------------------
Measuring Test Transaction Time in 2 ways

Using Transaction Points (Start and End) - UFT Tool feature

Or

Using Timer (VBScript Built in Function) - VBScript
---------------------------------------------------

Feb 25, 2015

UFT Tutorial 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
-------------------------------------------
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.

UFT Tutorial 10

UFT Class 10
(Descriptive Programming Part-2)

Descriptive Programming / Programmatic descriptions

> What is Descriptive Programming?

> Advantages of Descriptive Programming?

> Syntax for writing Test Object statements

Testobject("PropertyName:=PropertyValue").Child TestObject("PropertyName:=PropertyValue").Method or Operation

Or

Testobject("Property1Name:=Property1Value","Property1Name:=Property1Value").Child TestObject("PropertyName:=PropertyValue").Method or Operation

Example:

Dialog("text:=Login").WinButton("text:=Cancel").Click

> How to select appropriate Properties information for recognizing objects?

If the development team follows UI design standards then use UFT Object Identification Configuration
(*UFT Object Identification configuration Based on UI design standards)

If development team not follows UI design standards for some objects then
select one or two properties and perform dry run, if they are suitable then continue
otherwise change the properties and perform dry runs.

> Write Descriptive Programming

a) Steps/Navigation for Login functionality in FR application

i) Launch the Application

ii) Select the Login Dialog box

iii) Enter Agent Name

iv) Enter Password

v) Click OK Button
------------------------------

In this navigation we work with 4 objects

Login Dialog box -text property

Agent Name, Password Edit boxes -attached text

OK Button -text

Identify unique properties
-------------------------------------
Ex:
Systemutil.Run "C:\Program Files\HP\Unified Functional Testing\samples\flight\app\flight4a.exe"
Dialog("text:=Login").Activate
Dialog("text:=Login").WinEdit("attached text:=Agent Name:").Set "abcd"
Dialog("text:=Login").WinEdit("attached text:=Password:").SetSecure "54edcfd7c14cf9a3e6f38219556c9040102f5860"
Dialog("text:=Login").WinButton("text:=OK", "height:=23", "width:=60").Click
-------------------------------------------
> Centralized maintenance of Test Objects
Use Constants to replace literal values and place constants in a library file.

By associating the library file access objects information.

If any modifications are there, open the Library file perform changes and save.

VBScript constants

They used to replace literal values and they never change

Syntax:

Const constantName = Value

Ex:

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

---------------------------------
Ex:

Dim city
city="Hyderabad
-----------
----------
----------
city="London"
-------------
---------
-------------------------
Const city ="Hyderabad"
-------------
-------------
-----------
city ="London" *Error
----------------------------------
Ex:

Const Login = "text:=Login", Agent ="attached text:=Agent Name:", Password ="attached text:=Password:"
Const Ok1="text:=OK", Ok2="height:=23", Ok3="width:=60"

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(Password).SetSecure "54edcfd7c14cf9a3e6f38219556c9040102f5860"
Dialog(Login).WinButton(Ok1, Ok2, Ok3).Click

Create Library file

> Launch Notepad(Editor)

> Type or Paste the code

> Save as .vbs file

Associate Library file

Association two levels

a) Test Level

File menu -> Settings -> Resources ->Click Add symbol -> Browse path of the file -> OK

b) Tool Level

File menu -> Settings -> Resources ->Click Add symbol -> Browse path of the file ->Set As default-> OK

> We can associate one or more library files

Note: For every Test one Library file is not required, you place all objects information
in a single library file, by associating the library file we can create and execute N number of tests.
-----------------------------
Steps / Navigation for Gmail Login Functionality

i) Launch the Browser and navigate to "www.gmail.com"

ii) Enter Email

iii) Enter Password

iv) Click Sign in Button
----------------------------
Objects
----------
Browser - CreationTime

Page - title

WebEdit - name

webButton -name
--------------------------
Test script:

SystemUtil.Run "C:\Program Files\Internet Explorer\iexplore.exe", "www.gmail.com"
Browser("creationtime:=0").Page("title:=Gmail").WebEdit("name:=Email").Set "hariprasaduft@gmail.com"
Browser("creationtime:=0").Page("title:=Gmail").WebEdit("name:=Passwd").SetSecure "54edd9fc6feecf0a574835932c26c8ad092c53dcd2f8fd88b7dc7cb79ccc7f4d"
Browser("creationtime:=0").Page("title:=Gmail").WebButton("name:=Sign in").Click
-----------------------------
Handle Duplicate Objects

Latest Browser CreationTime - N-1 (10 Browsers opened on desktop, 9)

Oldest Browser creation time - 0

Only one Browser opened on Desktop Creation time - 0
-------------------------------------------------------------
Two links with same name

Use index property

Link("text:=News", "index:=1").Click
---------------------------------------
Descriptive Programming 2 types

a) Static programming

b) Dynamic Programming
-----------------------------
Assignments:
--------------
a) write Descriptive Program for Open Order Functionality in Flight Reservation

Base State: Flight Reservation Window

Navigation:

i) Activate the FR window

ii) select File menu

iii) Choose Open Order

iv) Check Order No check box

v) Enter Order Number

vi) Click OK button
---------------------------------
b) write Descriptive Program for Customer Registration functionality in dealsdirect.com.au

Base State: None

Navigation:

i) Lunch the Browser and Navigate to dealsdirect.com.au

ii) Click "Register" Link

iii) Enter Email Address

iv) Conform Email Address

v) Choose password

vi) Click Register & Continue Link
--------------------------------------------
c) write Descriptive Program for Login functionality in dealsdirect.com.au

Base State: None

Navigation:

i) Lunch the Browser and Navigate to dealsdirect.com.au

ii) Click "Login" Link"

iii) Enter Email Address

iv) Enter Password

v) Click "Login & Continue" Button"
------------------------------------------------------

Feb 23, 2015

UFT Tutorial 9

UFT Class 9
(Descriptive Programming Part-1)
Descriptive Programming Or Programmatic Descriptions


Enter / Provide objects information directly into statements/steps
is called Descriptive Programming.

No need to have Object Repositories separately, we provide objects info
directly in the Test/Test script only.

Descriptive Programming is faster in execution than object repository based Test.

Object Repository based Test Design

                               Recording                            Keyword driven methodology
                                ----------------------------------------------------------
Test external view           Same

Internal process        Uses Local Repositories            Shared object  repositories
--------------------------------------------------------------------------
Test External view:

Test object statements vary from OR based test to DP

Test Object Statements:


Single Test Object Statement

OR:
Syntax:
TestObject("Objectname").Operation
Ex:
Dialog("Login").Activate

Browser("Google").Close

DP:
Syntax:
TestObject("Property Name:=Property value").Operation
Or
TestObject("Property1 Name:=Property1 value","Property2 Name:=Property2 value" ).Operation

Object

Object is something which has structure and properties

Property

It is an attribute of the object, which describes the Object

Method / Operation

Operation on Object
-----------------------------------
Object

Man

Properties           Values

Name                    abcd

Color                     White

height                   6

weight                  70

etc...

Methods
---------
Speaking
walking
etc....
----------------------------
Browser

Properties:

title
Version  Ie 9
name    Gmail
openurl
etc...
----------------------------------------------
Ex:

Browser("CreationTime:=0").Close
Dialog("text:=Login").Activate
Or
Dialog("text:=Login", "width:=320", "height:=200").Activate

Two Test Objects statement


OR:
Syntax:

Test Object("Object Name").Child TestObject("ObjectName").Method / Operation

Ex:
Dialog("Login").WinButton("OK").Click

DP:

Syntax:
TestObject("Property Name:=Property Value").Child TestObject("PropertyName:=PropertyValue").Method or Operation

Ex:

Dialog("text:=Login").WinButton("text:=Cancel").Click
---------------------------
Ex:
Browser("CreationTime:=0").Page("title:=Gmail").Link("text:=Create an account").Click
---------------------------------------------------
Internal Process:


Test Execution Process in case of OR based Test:


During test execution UFT reads statements from UFT tool editor one by one
and gets objects information from Object Repository
based on that information performs actions on AUT.

Test Execution Process in case of DP:

During test execution UFT reads statements from UFT tool editor one by one
and objects information also available in the Statements
based on that information performs actions directly on AUT.