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

0 comments:

Post a Comment