title: Cleaning up data after a selenium test
body: <p>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?</p>
  
  <p>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.</p>
  
  <p>Some ideas:</p>
  
  <ol>
  <li>Manually connect to the database in the Selenium test to clean up the data</li>
  <li>Use something like <a href="http://dbunit.sourceforge.net/howto.html" rel="nofollow noreferrer">DBUnit</a> to manage this?</li>
  <li>Just add data and don't worry about cleaning it up (aka, the lazy approach)</li>
  </ol>
  
  <p>Thanks!</p>
  
  <p><strong>Edit:</strong> 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.</p>