Introduction: Perform a data-driven functional test using Java scripts
In this tutorial, you will learn how to create a data-driven test using a variety of realistic data to test the application with the Rational Functional Tester data-driver wizard.
You will use the ClassicsCD sample application to create a project and record a Java test script to verify that the ClassicsCD sample application correctly totals an order. You will also create a verification point with a datapool reference to check that the total amount of the order is correct in the Classics CD application.
A datapool is a collection of related data records. A datapool supplies data values to the variables in a test script during test script playback. Data-driven testing uses data from an external file, a datapool, as input to a test.
The diagram on the left shows a test script that uses data with hard-coded, literal references in the test script. The diagram on the right shows a data-driven test script that uses data from an external file, a datapool.
Hard-coded test script
Data-driven test script
Learning objectives
After completing this tutorial, you will be able to:
- Create a project and record a Java test script
- Data-drive a test
- Add descriptive headings to the data
- Create a verification point with a datapool reference
- Add data to the datapool
- Play back the test
Consider printing the tutorial before you begin and using the printed copy as you work through the lessons. To print this tutorial, see Printing multiple topics and creating PDFs
Time required
This tutorial should take approximately 30 minutes to finish. If you explore other concepts related to this tutorial, it could take longer to complete.
Lessons in this tutorial
- Lesson 1: Create a project and record a test script
In this lesson, you will use the Classics CD sample application to create a new project and start recording a test to verify that the sample application correctly totals the amount of music CDs purchased.- Lesson 2: Data-drive a test
In this lesson, you will use the data-driver to populate a datapool with data from the sample application. A datapool is a collection of related data records. A datapool supplies data values to the variables in a test script during test script playback.- Lesson 3: Add descriptive headings to the data
In this lesson, you will add descriptive headings to the datapool you created in the previous lesson. Descriptive headings make it easier to add data to the datapool.- Lesson 4: Create a verification point with a datapool reference
In this lesson, you create a verification point with a datapool reference to check that the price for the CD is correct in the ClassicsCD application.- Lesson 5: Add data to the datapool
In this lesson, you will add data to the datapool to test the ClassicsCD sample application by placing more orders for the CD.- Lesson 6: Play back the test
In this lesson, you will play back the test you just recorded to see how easy it is to use a variety of data from a datapool to test the application.