Thursday, August 11, 2011

How do you create / generate Test Data?

Testing (manual or automation) depends upon data being present in the product.

How do you create Test Data for your testing?

  • Manually create it using the product itself?
  • Directly use SQL statements to create the data in the DB (required knowledge of the schema)?
  • Use product apis / developer help to seed data directly? (using product factory objects)?
  • Use production snapshot / production-like data?
  • Any other way?

How do you store this test data?

  • Along with the test (in code)?
  • In separate test data files - eg: XML, yml, other types of files?
  • In some specific tools like Excel?
  • In a separate test database?
  • Any other way?

Do you use the same test data that is also being used by the developers for their tests?

What are the advantages / disadvantages you have observed in the approach you use (or any other methods)?

Looking forward to knowing your strategy on test data creation and management!


  1. Anand,
    Good to read this post that talks about one of the lesser talked about area of software testing. The domain I work with, sample data/test data is an extremely important aspect. Our number one choice if we get access to customer data, but it's a luxury if we get one. The richness of customer data in terms of user scenarios it supports is very good. However in may cases it would not contain all the scenarios that the product management has envisioned. In such cases, we augment the customer data with scenarios we code into the data with sql scripts.
    In the event of not getting customer data, we create data using SQL scripts. The initial seed is created using SQL scripts, and this is later modified to create the specific user scenarios and patters.

  2. Excel-to-database tool is handy for creating test data / uploading other data or batch testing stored procedures.