Preparing Test Data

Nishant Singh
1 min readFeb 21, 2018

This is the fifth chapter in the 7 part series : Practical Guide to Test Automation.

I am personally against the approach of creating test data using custom API’s or factories like factory girls, makeiteasy etc.

Because these are end to end tests, so they must be completely ignorant about the models being used by the system.

For this reason I recommend that the best way to create test data is through UI.

For the rails app at Zinc, I created rake tasks that can take the dump of data from database and restore it as required

The workflow for creating test data looks like this :

  • Load test data with rake command rake db:play
  • Create data using UI (avoid rails console)
  • run rake db:record
  • checkin the dump file

To make sure the dump file size is manageable, we can use gunzip under the abstraction of commands db:play and db:record.

Next: Cross Browser Testing and Runtime

--

--