Testing is a crucial part of the software creation process. It ensures that your code is working correctly and that all bugs are found before the software lands in the hands of consumers. But it can be difficult to explain these tests and their results to investors...
What is data-driven testing?
The ability to do data-driven testing is one of the key benefits of test automation. In data-driven testing, an automated test case retrieves input values from a data source such as an Excel spreadsheet or a database file. The test case is repeated automatically for each row of data in the data source. So, instead of 10 testers having to manually execute test cases for 10 different data values, and determine whether or not each test case succeeded, an automated test can execute 100 test cases in a single test run.
In a test case for a user registration process, the data source might contain the columns and rows like those shown below:
First Name | Last Name | Desired User Name | Desired Password | Expected Result |
John | Jones | jjones14 | Mypass123 | Pass |
Jody | Jones | jjones14 | Mypass456 | Fail |
Julia | Jones | jjones15 | mypass | Fail |
Input 1 | Input 2 | Expected Result |
12 | 12 | 144 |
15 | 50 | 750 |
-1 | 18 | -18 |
Benefits of data-driven testing
Reduced execution time
Increased accuracy
Improved use of system and human resources
Reduced test case maintenance
Better test data storage
Supports more than just testing
Best practices for data-driven testing
Separate test data from the test code whenever possible
Use realistic data
Use setup/teardown modules
Configure error handling
Watch our on-demand webinar
Mastering Data-Driven Testing: If you prefer video instructions, you can also watch our on-demand webinar. Learn how to set up variables and link them to data sources. You will also learn how data binding connects variables to data items, how to control execution with conditions and how to pass values through module boundaries and across test cases.
Related Posts:
Gherkin: Overview, Use Cases, and Format
Gherkin is a format used for cucumber testing. In this article, we go over what it is, its use cases, and the format of Gherkin.
The Importance of SQL Injection Testing
SQL injection testing is important for finding vulnerabilities and keeping your information secure. Learn more here.
6 Best Practices for Code Review
Code review is a daunting process, but there are ways to make it easier, more efficient, and more accurate. Learn more here.