After you record and then run a test, you can enhance it,
using the test editor in the IBM® Rational® Test Workbench Eclipse Client.
In this lesson you will learn how
to make the following edits to the recorded test:
- Add a loop so that the test runs multiple times
- Edit text in a text field
- Add a datapool to provide variable data rather than the data that
you recorded
- Reference the datapool in the test
- Substitute recorded values with the values in the datapool
After completing these steps, you can run the test to see
it iterate multiple times using the loop and the data in the datapool.
- Start by opening the test that you recorded in Lesson 4: Recording a test and enhanced in Lesson 6: Creating a verification point. If the test is not already open,
double-click the test in the Test Navigator to view the test in the
test editor.
If you used the UICatalog application to
record the test, the Test Contents window looks like this:

- Add a loop. With a loop, you can specify that the test
will run a specified number of times or for a specified period of
time.
- Right-click the first step in the test, Launch
application UICatalog 2.10 and select .
- When you see the prompt, Would you like
to move selected objects into New Loop?, click Yes.
The loop is added to the test as shown below:

- In the Loop Details section to the right, change Count-based to
3 iterations.

- Verify that the device is still in passive mode and
then click Run Test. If the device is not in
passive mode, tap Enter Passive Mode on the
device.
Note: At the beginning of each loop, you might
be prompted on the device to open a page in the UICatalog app. If
you see this prompt, click Open.
- Verify that the entire test runs three times.
- Now, try changing the text in a text field.
- In the User Action Details section, replace the text
in a Text field. For example, in the Object
Actions row, change the word Hello to
the word Greetings, and then click .
- Notice the change in the Test Contents on the left.
- Run the test.
- Now, add a datapool. Datapools provide tests with variable
data during a test run.
When you record a test, you
perform a sequence of steps that you expect a typical user to perform.
From the recording, a test is generated that exactly captures these
interactions. When you run this test, it uses the same data that you
used during recording. To vary the data in the test, you use a datapool,
in which variable data is substituted for the data in the recorded
test.
To create a datapool:
- In the Test Navigator view, right-click the UICatalog project
and click .
- In Name, type UICatalog_text and
click Next.
- Type a Description for the datapool
- In Variables (or columns), leave
it as 1.
- In Records (or rows), type 3 and
click Finish.

- Click Yes to open the datapool
editor.
- In the datapool editor, click Variable1:String and
change the column name to Text_String.
- Click each cell and enter data so that the datapool
looks like this:
- Click .
- After creating the datapool, update the test to include
a reference to the datapool.
- Right-click the name of the test in the Test Contents
window and click Add datapool.
The
Select Datapool File window opens, as shown below:

- In the Select Datapool File window, select the datapool
and click Finish.
- Click .
- After adding a reference to the datapool, you then substitute
the actual value that you used in recording with the ones from the
datapool.
- Navigate to the step in the test where you plan to add
the datapool, in this case the Enter text "text"
in Text field step.
- In the User Action Details area, right-click the actual
text in the Text field and click .
The Select Data Source window opens.

- Select the test and click Select.
If you are prompted to substitute for more values, click No.
The text in the Text field changes color.
- To save the changes, click .
- Run the test.
The test should now run three
times. The first run should use the text in row 0 - ABCD and test
alphabetical characters; the second run should use the text in row
1 - ABCD1 and test a combination of alphabetical and numeric characters;
the third run should use the text in row 2 - 1234 and test all numeric
characters.
.