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
---------------------------------------------------

0 comments:

Post a Comment