What do you fix when you fix a test?

You ran the tests1 - or a pipeline did it for you - and some of them failed. Time to fix the tests! But what is it exactly that needs fixing?

There are quite a few things that might make a test fail:

  1. an issue with the build
  2. an issue with the pipeline (if that’s where the test runs)
  3. an issue in the environment the code under test is running on
  4. an issue in the environment the test code is running on
  5. a bug in the code under test
  6. a mistake in the test code
  7. a mistake in what the test should test

Arguably, on the last three describe a test that fails. The test did its job detecting a problem. In the first four we didn’t even get that far. The issues prevented the test from doing its job. So in those cases, it’s not the test(s) as such that need fixing.

Read more…