Tests can be interrupted intermittently for a number of reasons and reveal why they fail, often show information about your code base and environment.
Here are a few possible reasons:
• Common objects — single states that hold state can cause problems between tests if the test environment is not reset to a well-known state. if if your test runner runs the tests in a non-deterministic order, you can see random errors that actually cause problems with the damaged state.
• Environmental and external dependencies - any external object that can hold a state can cause unpredictable results.
• Timing - sometimes tests are recorded with timeouts or sleep threads that are too specific. If the build server is running under heavy load, these timeouts may not be long enough.
As a general guide, tests should be:
- isolated: tests focus on one unit at a time
- repeatable: produces the same results every time
- independent: the order of execution of the tests should not matter
bryanbcook
source share