FLAKY TESTS

From Test Automation Patterns
Jump to: navigation, search
.................................................................................................................Main Page / Back to Execution Issues / Back to Test Automation Issues

Issue summary

The automated tests seem to pass or fail randomly

Category

Execution

Examples

  1. Mostly the tests pass but once in a while they fail. If they are rerun they pass as usual
  2. Automated tests fail because development was using your same database and changed its structure
  3. Testers changed the files test automation uses to compare results and now those tests don't pass any longer
  4. IT-Support shut down your machine to install some new software and killed your automation run
  5. IT-Support installed new software and now your tool doesn't work any more
  6. Automated tests run in parallel using the same databases and mess up each other's data
  7. A previous test failed and left the system "dirty" so that all successive tests also failed
  8. Automated tests assume that something in the test environment is immutable, i.e. will not change, because the setup is assumed to be under the testers' control and deviations can be corrected when spotted. (contributed by Derek Bergin)

Questions

Do the tests fail whenever a preceding test was also run? Or whenever a preceding test was not run?
What runs at the same time as the automated tests?
Did IT-Support run some updates just as the automated tests were running?
Was somebody working on the same database as the automated tests just as they were running?
Have the automated tests been sufficiently tested?
Who uses which machines and when? Is it possible to plan when each group has access to the machines?
Is there a central database for everybody or does each user or group have its own?
What are you depending on not changing in the test environment (what do you assume is immutable)? How will you monitor changes in the test environment (expected and unexpected)? Can you investigate the environment after a failure?

Resolving Patterns

The following patterns can all be recommended:


.................................................................................................................Main Page / Back to Execution Issues / Back to Test Automation Issues