Cleaning up data after a selenium test

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:

  • Manually connect to the database in the Selenium test to clean up the data
  • Use something like DBUnit to manage this?
  • Just add data and don’t worry about cleaning it up (aka, the lazy approach) Thanks!