Search code examples
javaseleniumrollbackgui-testinggui-test-framework

Rollback Database after running Selenium GUI tests


I am using Selenium GUI tests in a Java Web Application. Since these tests are actually client, how can we rollback database after running a test?


Solution

  • What you're after is called Fixture Teardown Patterns. Since you need to keep track of all resources that are created in a test and automatically destroy/free them during Teardown. I obviously don't know your framework, but for this case

    rollback database after running a test

    a good candidate is the Inline Teardown. It includes teardown logic at the end of the Test Method immediately after the result verification. Like so:

    enter image description here