Monday, March 12, 2007

How Do You Create Data-Driven Tests?

Once you have successfully debugged and run your test, you may want to see
how the same test performs with multiple sets of data. To do this, you convert
your test to a data-driven test and create a corresponding data table with the sets
of data you want to test.
Converting your test to a data-driven test involves the following steps:
• Adding statements to your script that open and close the data table.
• Adding statements and functions to your test so that it will read from the data
table and run in a loop while it applies each set of data.
• Replacing fixed values in recorded statements and checkpoint statements with
parameters, known as parameterizing the test.
You can convert your test to a data-driven test using the DataDriver Wizard or
you can modify your script manually.

When you run your data-driven test, WinRunner runs the parameterized part(s) of
the test one time (called an iteration) for each set of data in the data table, and
then displays the results for all of the iterations in a single Test Results window.
In Lesson 7 you created a test that opened a specific flight order and read the
number of tickets, price per ticket, and total price from a fax order dialog box in
order to check that the total price was correct. In this lesson you will create a test
that performs the same check on several flight orders in order to check that your
application computes the correct price for various quantities and prices of tickets.