Data-driven testing uses data from an external file, a datapool, as input to a test. A datapool is a collection of related data records. When you data-drive test, datapools supply data values to the variables in a test scripts during test script playback.
Because data is separated from the test script, you can:
The diagram on the left shows a test script, which 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 with literal references Data-driven test script with a datapool
Here are some examples of problems that data-driving tests solves:
Problem: During recording, you create a personnel file for a new employee, using the employee's unique identification number. Each time the test is run without data-driving the test, there is an attempt to create the same personnel file and supply the same identification number. The application rejects the duplicate requests.
Solution: You can data-drive the test script to send different employee data, including identification numbers, to the server each time the test is run.
Problem: You delete a record during recording. When you run the test without data-driving the test, Rational Functional Tester attempts to delete the same record, and Record Not Found errors result.
Solution: You can data-drive the test script to reference a different record in the deletion request each time the script is played back.
Data-driving tests gives a more accurate picture of the way the application under test works in the real world with real data.