Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

CS-6306 UNIFIED FUNCTIONAL TESTING Page|1

Creating Basic Test

Module 008 –Using Parameters

“Quality is never an accident; it is always the result of intelligent


effort.”
– John Ruskin

Overview of the Course


At the end of this module, you should be able to:
 Create basic scripts from a manual test case
 Enhance basic tests with synchronization and verification
 Parameterize tests to run with multiple sets of data

 Create and reuse modular actions


 Use the Object Repository

 Use debugging tools


 Write custom checkpoints to create more precise verification
points within a test
 Use the Object Repository Manager
 Resolve object recognition problems

Researching beyond the coverage of this module is highly


encouraged to supplement your understanding of the topics
covered. Always, think and see beyond the box.

The citation provided is a guideline. Please check each citation


for accuracy before use.

So, what are we waiting for? Let us now explore the Unified
Functional Testing 12.0
CS-6306 UNIFIED FUNCTIONAL TESTING
Using Parameters Page|2

Module Objectives:
After completing this module, you should be able to:

 Identify and use different parameter types

 Insert an input parameter

 Insert an output parameter

 Parameterize a checkpoint

 Evaluate test results for iterative tests

 Automatically parameterize steps


GUI Testing Workflow
Parameterizing Test Data

Parameters make an action or a test easily reusable. By


using parameters, testers can record a test once and use it
several times. Parameters enable multiple sets of data to be
run.
Parameter Types
Various parameters are as follows:
 Test/action – Enable you to use values passed from your
test. Action parameters enable you to pass values from
other actions in your test.
 Data Table – Enable you to create a data-driven test (or
action) that runs several times using the data you
supply. In each repetition, or iteration, UFT for GUI
Testing uses a different value from the Data pane.
 Environment variable – Enable you to use variable
values from other sources during the run session. These
may be values you supply, or values that UFT for GUI
Testing generates for you based on conditions and
options you choose.
 Random number – Enable you to insert random
numbers as values in your test. For example, to check
how your application handles small and large ticket
orders, you can instruct UFT for GUI Testing to generate
a random number and insert it in a number of tickets.
CS-6306 UNIFIED FUNCTIONAL TESTING
Using Parameters Page|3

Parameterizing a Test with a Single Data Set

You ran a test that you created in previous lessons to


check that a series of steps performed on the Flight Booking
application runs smoothly. Even after adding additional checks
in Creating Checkpoint, you ran this test with only a single set
of data. However, when you test your applications, you might
want to see the same operations performed with multiple sets
of data.

For example, you can run a test on your Web site using
ten separate sets of data. You can create ten separate tests, each
with its own set of data, or you can add ten sets of parameters
to a single test. If you add the parameters, your test runs ten
times, each time using a different set of data.

Using a Data Table


Global Sheet
A data table stores values for input and output
parameters in the test. UFT for GUI Testing displays the design-
time data table by default. Click the Data Table button in the
UFT for GUI Testing toolbar to display a data table.

The data table provides the features of Microsoft Excel


to enable you to store and use data as you do in a Microsoft
Excel spread sheet. Mathematical formulas can be executed
within the cells.

You store data in the Global tab when you want it to be


available to all actions in your test and you want the data to
control the number of test iterations. You must also store data
in the Global tab if your test is stored in ALM, and you want to
use the data awareness feature.
CS-6306 UNIFIED FUNCTIONAL TESTING
Using Parameters Page|4

You ran a test that you created in previous lessons to


check that a series of steps performed on the Flight Booking
application runs smoothly. Even after adding additional checks
in Creating Checkpoint, you ran this test with only a single set
of data. However, when you test your applications, you might
want to see the same operations performed with multiple sets
of data.

For example, you can run a test on your Web site using
ten separate sets of data. You can create ten separate tests, each
with its own set of data, or you can add ten sets of parameters
to a single test. If you add the parameters, your test runs ten
times, each time using a different set of data.

Using a Data Table


A data table stores values for input and output
parameters in the test. UFT for GUI Testing displays the design-
time data table by default. Click the Data Table button in the
UFT for GUI Testing toolbar to display a data table.

The data table provides the features of Microsoft Excel


to enable you to store and use data as you do in a Microsoft
Excel spread sheet. Mathematical formulas can be executed
within the cells.

Global Sheet

You store data in the Global tab when you want it to be


available to all actions in your test and you want the data to
control the number of test iterations. You must also store data
in the Global tab if your test is stored in ALM, and you want to
use the data awareness feature.

Current Action Sheets (Local)


You store data in the action's tab when you want to use
the data in data table parameters for that action only and you want
the data to control the number of action iterations.

For example, suppose you are creating a test on the


sample Flight Booking application. You might create one action
for logging in, another for booking flights, and a third for
logging out. You might want to create a test in which the user
logs onto the application one time, and then books flights for
CS-6306 UNIFIED FUNCTIONAL TESTING
Using Parameters Page|5
five passengers. The data about the passengers is relevant only
to the second action, so it should be stored in the action sheet
corresponding to that action.

Using a Global Sheet


The screenshot on the slide above displays Fly From and
Fly To destination being parameterized in the global data sheet.

The global data sheet provides a source of values that


can be used by any action in the test. When input data are
stored in a global data sheet, the complete test iterates for each
row of data.

Default iteration settings apply to all iterations in the test.

Using a Local Data Sheet


When you use a local data sheet, values specific to an
action appear in the action data sheets that are available to that
action only. Default iteration settings in the action data sheets
are specified for one iteration only.

Choosing Global or Action Data Table Parameters

When you parameterize a step in a test using a data


table, you must decide whether you want to make it a global
data table parameter or a local data table parameter.

Global data table parameters take data from the global


sheet in the data table. The global sheet contains the data that
replaces global parameters in each iteration of the test. By
default, the test runs one iteration for each row in the global
sheet of the data table. You can also set the test to run only one
iteration, or to run iteration on specified rows within the global
sheet of the data table. You can use parameters defined in the
global data sheet in any application.

Local (current action sheet) parameters take data from


the action's sheet in the data table. The data in the action sheet
replace data table parameters in each iteration of the action. By
default, actions run only one iteration.

The screenshot on the slide above displays Fly From and


Fly To destinations being parameterized in the global sheet.
CS-6306 UNIFIED FUNCTIONAL TESTING
Using Parameters Page|6

Data Table Location


To access the data table, select File Menu, then Test
Settings, then Resources. This takes you to the location of the
data table that can be used in your test.

Default Location (under test directory) Radio Button


Selecting the Default Location (under test directory)
radio button instructs UFT for GUI Testing to use data stored in
the default data table location under the test directory.

Other Location Radio Button


Selecting the Other Location radio button instructs UFT for GUI
Testing to use data stored in the specified data table location.
The data table can be any Microsoft Excel (xls) file.

Note: You can specify Microsoft Excel files stored in ALM as


data tables.

Replacing Static Data with Input Parameters


Input parameters enable you to replace a static recorded
value in a step with a placeholder for a dynamic value. This
placeholder is called a parameter and enables you to use
multiple values during the test run.

Input parameter names and their values are located in the Data
Table.

When you record a test, it is recorded as static data for


an object that is an object with a fixed value). This fixed value
must be configured so that you can check how your object and
your test respond to a set of data.

Input parameters enable you to replace a static recorded


value in a step with a placeholder for a dynamic value. This
placeholder is called a parameter and enables you to use
multiple values during the test run.

Input parameter names and their values are located in the data
table.
CS-6306 UNIFIED FUNCTIONAL TESTING
Using Parameters Page|7

Setting the Parameter Value


To set the parameter value, perform the following steps:

1. In Keyword view, select the step that contains the recorded


input value.

2. In the Value column, click to display the Configure the value


button.

3. Click Configure the Value. The Value Configuration Options


dialog box is displayed.

4. In the Value Configuration Options dialog box, select the


Parameter option. Ensure that the data table is selected from
the Parameter list.

5. In the Name field, type a unique column name to create a


new column in the data table or select an existing column
name from the Name list.

6. Use the default global sheet to store the value.

View Configuration Options


The View Configuration Options dialog box enables you to
define a selected value as a constant or a parameter. In some
situations, you can also define the constant or parameter using
a regular expression.

Constant
The constant is a manually defined value that remains
unchanged for the duration of the run. You can edit the value
directly in the Constant box.
CS-6306 UNIFIED FUNCTIONAL TESTING
Using Parameters Page|8

Regular Expression (Tests and Scripted Components)


The Regular Expression option enables you to specify a
constant value using a regular expression. This option is
available only for string value types in some situations, for
example when parameterizing an object identification property
value. This option is not available for method arguments or for
keyword components.

To use a regular expression, enter a regular expression


in the Constant box and select the Regular expression check
box.

Parameter
A parameter is a value that is defined or generated externally
and is retrieved during a run session. The parameter section
displays:

 The current parameter type and details for the value if a


value is already parameterized.

 The default parameter type and details for the value if a


value is not yet parameterized. You can change the
default definition by selecting a different parameter type
or modifying the parameter settings for the value.

Supplying Data to the Parameter


The design-time table is the central location to store input
parameter values. Enter the parameter values in the data table.
The number of rows in the data table is the number of test
iterations of the test run. You can configure values.

Click the Configure Value icon and can enter multiple values for
an object. Go to the Keyword view, under the Value field select
the Fly From: object you want to parameterize and then click
configure. This brings up the Value Configuration dialog box.
Change the value from Constant to Parameter. Enter the Name
and Location in the Global data table. Observe how the new
column is created in the data sheet for that parameter.
CS-6306 UNIFIED FUNCTIONAL TESTING
Using Parameters Page|9

Similarly, configure Fly To: destination. In Data Table,


input multiple values for Fly From (p_Item) and Fly To
(p_item1). You now must parameterize your object values.

Setting the Number of Iterations


You can specify the number of iterations that will be
executed during a test run. With a test or an action in focus,
select File, then Settings, then Run.

Data Table Iterations


The Data Table iterations dialog box enables you to
specify the iterations for the test. Select an option:

 Run one iteration only – Runs the test only one time, using
only the first row in the global data table

 Run on all rows – Runs the test with iterations using all rows
in the global data table

 Run from row __ to row __ – Runs the test with iterations


using the values in the global data table for the specified row
range.

Test Result Iterations


View the test results window to verify that each row from the
data table is executed during the test run. In the test results
window, expand the test summary tree to view information
about the execution of the specific row.

Output Parameters
An Output parameter is the value of a property captured
from the AUT during test execution. When you run a test, UFT for
GUI Testing retrieves the value of the property and enters it in
the run-time data table as an output value. You can then use this
output value as an input variable in your test.

Inserting Output Parameters


An Output parameter is the value of a property captured from
the AUT during test execution. When you run a test, UFT for GUI
Testing retrieves the value of the property and enters it in the run-
time data table as an output value. You can then use this output value
CS-6306 UNIFIED FUNCTIONAL TESTING
Using Parameters P a g e | 10
as an input variable in your test.

 Insert Output Value during Recording

 Start a recording session.

 Do one of the following:


 Select Design, then Output Value, then Standard Output Value.
or
 In the record toolbar, click the Insert Checkpoint or the Output
Value down arrow and select Standard Output Value.

In your application, click the object for which you want to


specify an output value. The output Value Properties dialog box
opens for most objects, and the Table Output Value Properties
dialog box opens for Table items (if you are working in a test or
scripted component).

Insert Output Value after Recording

1. Go to active screen for the step which contains the object for
which you want to specify the output value.

2. Right-click the object for which you want to specify an output


value and select Insert Output Value

3. Select the Object from the object tree and click the OK button.

4. Apply the new properties using the Output Value Properties


dialog box.

Inserting an Output Parameter While Recording


To insert an Output parameter while
recording, complete the following steps:
1. Start a recording session.

2. Do one of the following:

 Select Design, then Output Value, then Standard

Output Value. or

 In the record toolbar, click the Insert


Checkpoint or the Output Value down arrow
and select Standard Output Value.

3. In your application, click the object for which you want to


CS-6306 UNIFIED FUNCTIONAL TESTING
Using Parameters P a g e | 11
specify an output value.

4. The Output Value Properties dialog box opens for most


objects, check the properties that you want to
parameterize.
5. Click Modify. The Output Options dialog box is displayed.

6. In the Name field, select or type the column name to be


used in the global data sheet and click the OK button.

7. In the output value properties dialog box, click the OK


button.

Parameterizing a Checkpoint
Parameterized expected values can make checkpoints
dynamic. A dynamic checkpoint is a checkpoint that can check
for any value generated at run time.

You can also use a checkpoint and parameterize it. You can
apply a checkpoint for Agent name while you log into the Flight
Booking application.

To record a test for booking a flight, complete the following


steps.
1. In the Keyword view, go to the Agent Name row (Login
Step).

2. Right-click Agent Name (under the Item tab of Keyword


view). Select Insert Standard Checkpoint.

3. In the Checkpoint Properties dialog box, keep only the


text property option checked.

4. Select the Parameter radio button and click the OK


button.

This creates an Agent_Name_text column in the global data


sheet with mercury as the first value. Manually add two more
values in subsequent rows of these columns.

Now when you run the test and it opens the window where you
need to enter Agent Name and Password, you must run the
agent name all three times. Ideally, for all checkpoints to pass,
you should enter Agent Name in the sequence you defined in
the global data sheet.
CS-6306 UNIFIED FUNCTIONAL TESTING
Using Parameters P a g e | 12

Parameterizing an Object
To parameterize an object property’s value in the object
repository, perform the following steps:

1. Open the object repository.

2. From the Object Repository tree, select the object


that changes dynamically.

3. In the test object details section, click the value


field for the property that you want to modify. The
Configure the value button is displayed.

4. Click Configure the value. The Value Configuration


Options dialog box is displayed.

5. Select the Parameter option. From the parameter


list, select the column name that stores the
dynamically changing object value, and click the
OK button to close the Value Configuration Options
dialog box.

6. Close the object repository

Random Number Parameter


The Random Number input parameter generates
random numbers and uses them as input value for a parameter.
By default, the random number ranges between 0 and 100. A
different random number is generated every time the
parameter is called for every iteration or for every test run.

The Random Number parameter enables you to insert


random numbers as values in your test or component. For
example, to check how your application handles small and large
ticket orders, you can have UFT for GUI Testing generate a
random number and insert it in a number of tickets edit field.

You can modify these settings in the Parameter Options


dialog box.

Environment Parameter
 With a test, action, or scripted component in focus,
CS-6306 UNIFIED FUNCTIONAL TESTING
Using Parameters P a g e | 13
select File, then Settings, then Environment.

Environment parameters enable you to insert a value in


the test from an environment variable list. The value of an
environment parameter remains the same during the test
playback, regardless of the number of iterations, unless the
value is changed.

This pane displays existing built-in and user-defined


environment variables. It also enables you to add, modify, or
delete internal user-defined environment variables, export the
defined variables to an external xml file, and retrieve them from
a file.

Built-in Variable Type


The Built-in variable type displays the built-in
environment variables defined by UFT for GUI Testing and their
current values. This area provides the following information:
1. Name – The name of each built-in environment
variable

2. Description – A short description of each built-in


environment variable

3. Current value – The current value of the selected


environment variable.

User-Defined Environment Variables Area

1. Name – The name of each user-defined variable.

2. Value – The value assigned to each user-defined


variable.

3. Type – The type of each user-defined variable is


Internal or External. Internal environment variables
are available only to the test in which they are defined.

4. Add – Enables you to define a new internal


environment variable and add it to the list.

5. Delete – Deletes a selected internal environment


variable from the list.

6. Export – Exports your user-defined environment


variables to an external xml file for use with other
tests. You can then use the exported environment
variable file with any test by loading them from the
file as external user-defined environment variables.
CS-6306 UNIFIED FUNCTIONAL TESTING
Using Parameters P a g e | 14
7. Load Variables from External files – Instructs UFT
for GUI Testing to load the variables

8. File – The environment variable xml file to load


and use when your test runs. Click the

9. Browse button to open the Open XML File dialog


box.

Run-Time Table after Playback


After test execution, UFT for GUI Testing creates and
saves the run-time data table with the test results. A copy of the
design-time table is stored with your test.
CS-6306 UNIFIED FUNCTIONAL TESTING
Using Parameters P a g e | 15

References and Supplementary Materials


Books and Journals
Micro. Customized Unified Functional Testing 12.0 Essentials
Student Guide
Hewlett-Packard Development Company, L.P.
http://hp.com/software/education

You might also like