Wednesday, April 28, 2010

Automatic test data generation

Among other things, you need test data to execute tests. You are required to design the test data to drive your test cases. If the test data is not already listed with your test cases or you run tests in an exploratory manner, you need to design the test data on the fly. Generating your own test data takes away your valuable time. Generating test data by hand is especially time consuming if you have to run automated tests (e.g. functional tests or performance tests) which need a large quantity of distinct test data.

Of course, if the production data is available, you may get its copy and use it for test. However, this is not a very wise approach. Using live data in test may expose confidential customer information to unauthorized people. In fact, acts like HIPAA address the security and privacy of data.

The good thing is that you need not rely on generating test data by hand. Several tools are available that can help you create large quantities of test data based on the constraints or conditions specified by you. Automated test data generation has the following benefits:
FastIf the number of test data items is large, automated test data generation may be substantially faster than creating the same test data by hand.
AccurateSince test data generation is a tedious task, you are likely to make mistakes. Test data generated by a tool can be much more accurate.
Can use built-in algorithmsThe test data generator may implement algorithms to generate correctly formatted special data like postal codes and email addresses. Therefore, you need not look up the algorithms for generating the special test data yourself.
Create both valid and invalid test dataJust as you can create valid test data, you can also create invalid test data by specifying incorrect constraints. Further, by specifying the quantity of the valid and invalid data, you can control the percentage distribution between valid and invalid data.
Data exportable to multiple formatsThe automated test data generators usually provide options to either generate the test data directly in the desired format (e.g. Excel, CSV or SQL) or export to the desired format.
Create a professional lookSince automated test data generators use their own databases to source data, the test data added/ edited in your application looks professional. This way, you can avoid test data that looks odd (e.g. Name as aa or abab12). This is important in a way because the test data used by you is stored in your application and reported in your bug reports. If your client or management looks at your bug reports, you would feel better if the test data looks good (e.g. Name as Jackson or Burke).

Even though an automated test data generation may offer so many benefits, you should remember that it is just another software. Like other software, it may or may not have all the features you need or always generate the correct data. However, if you are willing to try automated test data generation, you could be boosting your productivity or the productivity of your team.

An example of a free test data generator is Data Generator

Note: I said "among other things" since sometimes it is necessary to populate an application with test data before the application can even function (fully).