Data-driving tests overview
When you data-drive a test, the script uses variables for key application input fields and programs instead of literal values so that you can use external data to drive the application you are testing.
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 which supplies data values to the variables in a test script during test script playback.
Because data is separated from the test script, you can:
- Modify test data without affecting the test script
- Add new test cases by modifying the data, not the test script
- Share the test data with many test scripts
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 solve:
Problem: During recording, you create a personnel file for a new employee, using the employee's unique social security number. Each time the test is run, there is an attempt to create the same personnel file and supply the same social security number. The application rejects the duplicate requests.
Solution: You can data-drive the test script to send different employee data, including social security numbers, to the server each time the test is run.
Problem: You delete a record during recording. When you run the test, 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.
Problem: You delete a record during recording. During playback, each transaction attempts to delete the same record, and "Record Not Found" errors are returned. Solution: You can use a datapool to reference a different record in the deletion request each time the transaction repeats.
Data-driven functional tests
Field separators for datapools