Currently SimpleTest resets the database by creating a fresh install of Drupal in a prefixed set of tables before every test function is run, but it doesn't reset all environment areas.
I noticed this when updating the upload tests. When files are uploaded and not deleted they just sit in the upload directory even thought the referencing node has been deleted when the database is fried. This is the expected behavior, but causes issues.
Especially if these tests are run on every patch the test servers will get an enormous amount of copied files sitting in the directory. There could be other areas of the environment similar to this, but the database and files directory are two major ones.
I think we need to add some code to
tearDown that clears the files directory excluding the simpletest folder. This could be an issue if SimpleTest is intended to run on production server, which I still don't think is a good idea. In order to compensate SimpleTest would need to record a snapshot of the files directory before and after the tests.
Even the above idea could have problems if multiple test sessions are running. I suppose the best idea would be to read the files table and just remove all files based on that, just before the prefixed database is fried. Not sure if there is a function that already does that.
Any comments or possible areas that also need resetting.