Eradicating Non-Determinism in Tests

Linked on Apr 14 at 21:06

I hate non-deterministic tests, which is why I strive for a completely fresh testing environment for each and every test. In-memory databases make this much easier (and faster). Python makes it easy to construct file-like objects for tests instead of relying on files on a filesystem. When testing an application which must hit the filesystem, I leverage fresh temporary directories and clean them up after every test.

Unfortunately, a fresh testing environment on every test is not always possible. Martin Fowler outlines more ways in which non-determinism in tests can be eliminated for more reliable test results.