I'm setting up some Selenium tests for an internal web app and looking for advice on a testing 'best practice'. One of the tests is going to add some data via the UI that cannot be removed via the UI (e.g., you can add a record via the web app, but removing requires contacting someone internally to remove it at the database level). How do you typically account for cleaning up data after the Selenium test is run?
The app in question is written in PHP and I'm using PHP for testing (with Selenium RC and SimpleTest), but I'm open to other tools, etc. as this is just a broad best practice question. The app being tested is in our development environment, so I'm not particularly worried about data carrying over from tests.
Some ideas:
Thanks!
Edit: Seems most of the ideas centered around the same conclusion: work off a known set of data and restore when the tests are finished. The mechanism for this probably will vary depending on language, an amount of data, etc. but this looks like it should work for my needs.
Currently we have test data stored in variables in our tests. We use variables e.g. private final static String SOME_DATA ="value"; which we can reuse across tests from given TestClass but if we need it in another Test Class we have to repeat it there.
Test plan: Get the application environment specifications from the development team. Then, identify the objects in the Application which is under test. Further, create the test cases and select the appropriate framework based on the requirements.
I use Selenium with a Rails application, and I use the fixture mechanism to load and unload data from the test database. It's similar to the DbUnit approach, though I don't unload and reload between tests due to the volume of data. (This is something I'm working on, though.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With