Test data plays an important role in executing test cases. Designing appropriate data is one of the main tasks of application testing.
What is Test Data?
Test data is a production like data used by Test Cases to test software applications. Usually, Test Data is collected into a document called Test Data Document, that is used by Test Cases and Test Scripts at the time of execution.
If the test data is not designed in advance, Test Cases may not cover all the scenarios and ultimately might affect the quality of the software.
Test data is divided into two types:
- Valid Test Data: is the positive data used for the system when generating expected results. This is a combination of all possible inputs to make sure the application is working as per the requirements.
- Invalid Test Data: is the negative data used to test unexpected or negative conditions and exceptions. Below are some examples:
- Null Values – in case of mandatory fields
- Out Of Range Values
- Special characters that are not allowed
- Invalid data format – for eg. mobile# with alphabet
Good test data is a combination of valid and invalid data to cover all positive as well as negative Test Scenarios.
When and Who write Test Data?
Typically the sample data must be created before testing begins and at the time of designing Test Cases. Because in many test environments creating test data can take many steps to configure the test environment. In addition, if the creation of test data is performed during the test execution phase, it may delay execution.
Testers are the ones who are responsible for creating software test data. But in some cases like medical or banking software where data is more sensitive, Business Analysts might provide masked production data as test data.
How to Create Test Data?
Test data can be created:
- Manually: This is the most common way and mostly created in an excel sheet, where testers need to consider test Scenarios and test conditions and use the combinations correctly. Word files, Text Files, XML files can also be used to create test data.
- Copy From Production: Typically in case of Load, Stress and Performance testing where a large amount of data is required.
- Using Automated data generation tools like DTM Test Data generator, a customizable utility that generates data, tables (views, procedures, etc). This data is used for database testing, performance testing, functional testing, load testing or usability testing.
Let’s take below Test Application to explain Test Data
Here are the requirements of User ID and Password:
User ID Requirements:
- Minimum length is 3 characters, maximum is 15.
- Only special character allowed is ‘_‘
- User ID must be Unique.
- Minimum length is 5 characters, maximum is 15,
- At least 1 upper-case Alphabet,
- At least 1 lower-case Alphabet,
- Minimum One Number,
- Only special characters that are allowed: ! # $ % * ? @ &
So, below is the Test Data created for maximum test coverage of the above requirements
You can download the Test Data Template here :
- Test Data should be updated regularly.
- It should be created before test case execution, at the time of Test Case designing.
- Test data should have invalid inputs to test negative scenarios.
- Use some automation tools to create a huge amount of test data for load or stress testing.
- Don’t hesitate to take the developer / BA’s help to create test data.
- Finally, it is always a better practice to include all possible combinations of supported and unsupported formats in test data. This ensures maximum test coverage.