2. What is Data-Driven Testing
How to Create Data-Driven Tests
Data-Driven Testing by examples
Overview
3. What is Data-Driven Testing
Data-driven testing: a scripting technique that stores test input
and expected results in a table or spreadsheet, so that a single
control script can execute all of the tests in the table.
[ISTQB – Glossary Standard Glossary of Terms used in Software Testing Version 2.4]
In the simplest form the tester supplies the inputs from a row in
the table and expects the outputs which occur in the same row.
The table typically contains values which correspond to
boundary or partition input spaces.
[Data-driven testing, From Wikipedia, http://en.wikipedia.org/wiki/Data-driven_testing]
4. On Data-Driven Testing
Data-driven testing is a testing methodology where
test input and output values are read from data files
and are loaded into variables in the test scripts
Data-driven testing allows executing the same test
(or tests) multiple times with different set of data
Test input and output verification data values are
separated from the test code
5. On Data-Driven Testing
Test data can be stored in one or more central data
sources, such as external files (xls, csv, xml, …) or
databases
Data-driven testing is used generally for applications
requiring fixed set of actions to be performed, but
with a lot of permutations and combinations of the
various parameters which form the test cases
6. Pros & Cons
Advantages of data-driven testing /1
Test Data can be designed while application development is in
progress
Clean separation of Test Case and Test Data
Changes to the Test Case/Scripts do not affect the Test Data
Only the script representing a “business function” needs to be
modified in case of any change in functionality
7. Pros & Cons
Advantages of data-driven testing /2
Repeatability and Reusability
the same tests can be executed several times with multiple
sets of data
Reduction in Number of Test Cases/Scripts
Data-driven Scripts result in less amount of code
8. Pros & Cons
Disadvantages of data-driven testing
Quality and coverage strongly depends on the automation skills of
implementing person
Data validation is required.
[Manual testing for] data validation process is time consuming,
particularly when testing large pools of data
Continuous maintenance issues due to a big amount
of code
9. How to Create Data-Driven Tests
Common Steps involved in Data driven Testing:
1. Create a test script with a set of constant test data
2. Replace constant test data with some variables
3. Create multiple sets of test data in a data storage (e.g. Excel,
CSV, XML, ...)
4. Assign to variables the values read from the data storage
10. Architecture of Data-Driven Tests
A data-driven test includes the following operations performed
in a loop:
1. Retrieving input data from storage
2. Entering data in the application–under–test
3. Verifying the results
4. Continuing with the next set of input data(*)
(*) Every set of input data delivers the data for a different test case.
11. The example application
Passwords shall use the following
types of characters:
• Lowercase
• Uppercase
• Numbers
No special characters such as
!@#$%^&*(){}[].
12. The Test Tool – Maveryx
Maveryx is a
professional, test
automation tool for
functional and
regression testing of
Java™ & Android™
applications.
13. Architecture of the Test Scripts
With this configuration there are multiple variations that must be tested:
Test Script
1. Enter username
2. Enter Password
3. Click "Login" button
4. Verifying the results
5. Click “OK" button
14. The Test Script
Test Script
1. Enter username
2. Enter Password
3. Click "Login" button
4. Verifying the results
5. Click “OK" button
15. Data-Driven Testing Step #1
1. Create a test script with a
set of constant test data
2. Replace constant test data
with some variables
3. Create multiple sets of test
data in a data storage (e.g.
Excel, CSV, XML, ...)
4. Assign to variables the value
that is read from the data
storage
16. Data-Driven Testing Step #2
1. Create a test script with a set
of constant test data
2. Replace constant test data
with some variables
3. Create multiple sets of test
data in a data storage (e.g.
Excel, CSV, XML, ...)
4. Assign to variables the value
that is read from the data
storage
17. Data-Driven Testing Step #3
1. Create a test script with a set
of constant test data
2. Replace constant test data
with some variables
3. Create multiple sets of test
data in a data storage (e.g.
Excel, CSV, XML, ...)
4. Assign to variables the value
that is read from the data
storage
18. Data-Driven Testing Step #4
1. Create a test script with a set
of constant test data
2. Replace constant test data
with some variables
3. Create multiple sets of test
data in a data storage (e.g.
Excel, CSV, XML, ...)
4. Assign to variables the value
that is read from the data
storage
19. Anatomy of the Test Script /1
1. Manage Data Sources
2. Retrieve input data
from storage
3. Enter data in the
application-under-test
4. Verify the results
5. Continue with the
next set of input data
Create a data manager using the constructor provided
by the TestDataManager class.
Excel
CSV
XML
20. Anatomy of the Test Script /2
1. Manage Data Sources
2. Retrieve input data
from storage
3. Enter data in the
application-under-test
4. Verify the results
5. Continue with the
next set of input data
Retrieve the data at the specified i-ndex of the column “Username”.
21. Anatomy of the Test Script /3
1. Manage Data Sources
2. Retrieve input data
from storage
3. Enter data in the
application-under-test
4. Verify the results
5. Continue with the next
set of input data
22. Anatomy of the Test Script /4
1. Manage Data Sources
2. Retrieve input data
from storage
3. Enter data in the
application-under-test
4. Verify the results
5. Continue with the
next set of input data
23. Anatomy of the Test Script /5
1. Manage Data Sources
2. Retrieve input data
from storage
3. Enter data in the
application-under-test
4. Verify the results
5. Continue with the
next set of input data
25. Lessons Learned
1. Data-Driven Testing allows writing the test cases as scripts
that read their data from external files, instead of using the
same hard-coded values each time
2. By this approach there is only 1 script to drive the tests but by
changing the data testers can create any number of test
cases
26. Lessons Learned
3. With Maveryx you can separate test logic from test data.
Maveryx supports the most popular external sources
4. A good data-driven test script :
1. Read test data from the data storage
2. Input the data into the application-under-test
3. Verify the results
4. Continue with the next test data
28. Maveryx is a professional, award-winning test automation tool for
functional and regression testing of Java™ & Android™ applications.
Maveryx provides testers with automated testing capabilities for
functional, regression, GUI, data-driven and keyword-driven testing.
Maveryx
30. No GUI Maps
No Recording. No Object Spy.
No Object Maps. Nothing.
o No GUI MAP needed to create and run the test scripts
o No Object Repository to learn & maintain, maintain, maintain…
o No pre-recording or screen capture
o Independent of screen coordinates and resolutions
⇒ Test scripts immediately executable!
36. Useful Links
o Maveryx – http://www.maveryx.com
o User guide – http://www.maveryx.com/en/support/learn-
more/user-documentation.html
o Forum – http://www.maveryx.com/en/forum/index.html
o Training – http://www.maveryx.com/en/services/training.html