Seems to me like your test bed would be more reliable if each test is responsible for resetting its own global state before it is run. If you rely on everybody else cleaning up after themselves, you're gonna get burned by another developer.<p>To use the drier example, if my test always cleans lint <i>before</i> running, I know my test will always run with a clean lint filter.<p>If I instead rely on <i>all other tests</i> cleaning the lint filter <i>after</i> their tests, it only takes one developer to make a mistake and break my tests' assumptions.<p>As for tests "cleaning up after themselves", that's generally a good idea if you are, for example, altering a database, generating a file, etc. However, that is also error prone (just takes one developer to mess it up and forget to delete a generated file). The way I've made that more reliable is running tests in a docker container so that any new files, etc. created are destroyed when the container is destroyed at the end of testing. I've also toyed with the idea of using the VCS to clean test fingerprints (i.e. git clean) but the main problem I've run into with that is some developers' tests will write stuff to /tmp.
In my experience, it's even a bad idea to share <i>immutable</i> data between tests. At least, certain types.<p>Basically what happens is you write a bunch of tests, and they all operate on a Person let's say. So you get into the habit of making a 20 year old Tom with bla bla bla each time. Very repetitive. So you decide to move Tom into a common file that every test can import. Typical DRY stuff.<p>Then, over time, Tom grows tentacles. Every test that uses Tom needs just one more little detail to be added. Tom needs to have a height for the height test. For the shopping test Tom needs a walking speed and a preference for ladders. These properties keep accumulating, and Tom grows huge. His growing complexities, and his presence in so many tests, make it impossible to remove or edit anything about him. You resort to making Tom variants. In each test you clone Tom then tweak his weight and shoe type or whatever. Of course nobody is making sure that all these properties and property edits are inter-consistent, and you find that because of this even adding properties to Tom has somehow become difficult. Eventually, understanding all facets of Tom becomes a black art. New tests fail sometimes, and no one knows why. You poke and prod Tom for a couple hours, and the problem goes away. Eventually even basic usage of Tom also becomes a black art.<p>You should have just repeated yourself.