Thats the worst part for a developer, when a developer has to insert the test data in the database to test the unit test cases.
There are various tools in the market to insert the test data in the database, one of them is Red gates sql data generator and other are available as well and all claim to create a sensible test data.
However I am not very much impressed by these tools as all of them just create the data on assumption, so if it is general data like city, market, country etc. then these tools are really good to use otherwise you yourself have to create all the test data.
So my approach would be just create 1-2 records in all the tables (start with base/reference tables) and then use T-SQL and those records to insert some more rows identitical to those records, by doing this you will get a sensible data as you are aware what needs to go down in the tables and you can create as many records as required to do any kind of testing, can create scenarios and many more things.
so what to do…
Create data for first table
insert into tab1 (col1,col2) values (’1′,’2′)
insert into tab2 (col2,col1_1) values (’1′,’1′)
And now use the same data to insert records in rest of the tables and to insert the record in same table as well.
Will provide you more details in next article, till then try it yourself, if you are really looking for some sensible data in your test database.