vendredi 3 juillet 2020

Clean up data after test

In the process of testing we all do create test (dummy) data on different env levels like (dev, qa, cluster & sometimes staging). When you have a small amout of tests everything is fine, but when you have a large amount of tests and when they are executed in paralel as in my case tests are interfering because they're using the same data.

So my goal here is to isolate every test and make them independent from other tests. I'm planning to create unique data for each test and every test will work/manipulate with it's on data.

The question is how do I clean up all of the data that were created during test execution, so tests will be able to create same data each time they are executed? Has any one else been through such a case and found a good solution for this?

My testing framework is built on Java, using Cucumber with Serenity BDD and RestAssured (for testing Web UI and API).

p.s there's a solution I have in mind currently and that's to keep track (something like using session variables) of every object I create whether using Web UI or API and on the final step of every test (by using '@After' method) using API to get the ID's of every object I've created and then do a delete Rest request to delete these items which will delete them from the database too.

Aucun commentaire:

Enregistrer un commentaire