Skip to content

Instantly share code, notes, and snippets.

@psahni
Last active August 29, 2015 14:20
Show Gist options
  • Save psahni/410f1fb4ea98b0ce4a8b to your computer and use it in GitHub Desktop.
Save psahni/410f1fb4ea98b0ce4a8b to your computer and use it in GitHub Desktop.
Automated test case and restoring the database.

#Integration testing with live test website. Restoring the state of the database after test suite. ##Challenges

  1. Running the test cases with existing data on test website.
  2. Restoring the original state of data.

Solution proposed

  1. Taking backup/dump of the database, then run test cases over it and after completion of test suite restore the data from dump.

  2. Create a new database which is exactly a copy of the existing database, change the database name in configuration. database.yml in case of rails. Update the name after the completion of test cases.

  3. Identification of important flows, finding out the queries fired in those flows and then writing opposite queries (rollback). Or Writing script to test the flow and also writing the script to rollback the changes that occured in that flow.

  4. Taking backup of data on local machine and run test cases over it on local machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment