Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / DevOps / testing

How to generate test data?

0.00/5 (No votes)
24 Nov 2011CPOL1 min read 40.2K  
During testing phase you would like to generate range of test data so that you can test your application properly. Most of the times testers end up doing monkey testing or exploratory testing.

The biggest problem with codeproject.com tips and tricks section is I cannot upload images. This tip needs images for better understanding.

So in case the below text is not sufficient to understand how to use this tip you can also see this video which goes step by step http://www.youtube.com/watch?v=8R3-xgmOTeE

If you do not want to watch that 10 min long video and do a quick read below is the text which explains the tip.

During testing phase you would like to generate range of test data so that you can test your application properly. Most of the times testers end up doing monkey testing or exploratory testing. In other words they start hitting the application with various permutation and combination of data to see if the validations are appropriate. It’s very much possible that your tester can leave some combinations out.

So the answer is use the data generation plan template from SQL Server project.

Click on visual studio, create a SQL Server database project and add data generation plan template to your project. In that template you can use regular expression to generate various combinations of data.

For instance let’s say you want to generate test data for invoice number with following constraints:-

Validation 1:- Invoice number should always start with INV and rest of the part should be numeric. INV1001 INV2003

Validation 2:- Invoice number should be in the length range of 4 to 8.

You can specify in regular expression INV [0-9]{4,8} and rest the template will do the work.

You should get something as shown below.

INV1001
INV2
INV567
INV0122
INV1001
INV590
INV9023
INV0127

For further reading do watch the below interview preparation and step by step video series.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)