How to revert the changes made by selenium in a tear down process?



  • I am in a situation where I have to revert all the changes which I made while testing the application. Is there any way of doing this in Testng? Suppose if I have added something into the application during testing add functionality. now when I am tearing down this test case, I have to revert the changes. Any suggestions how to do this? If I have deleting functionality then I can delete that added thing in tear down. but that would be a kind of test case for delete functionality into a tear down process. isn't it? Also if we don't have any delete functionality then. Anyone who knows how to revert the changes, please suggest. I am taking selenium webdriver and testng in use.



  • Like Josa Pita says, that is nothing for testing frameworks itself. The developers could write a script to save the current version of the DB. The process should look like that: Save current version of DB/any kind of data storage. Start test run. After test run finished restore the saved version of the DB/any kind of data storage. But I think it is only a solution for Applications with not too big databases/any kind of data storage. You also could have troubles with manual tests while the test run. But the best solution would be a own test environment with a own database/any kind of data storage. Also talk to the developers. Tell him your trouble and find a solution together.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2