I wish everyone would move away from code coverage as a metric and towards some kind of mutation framework.

There seem to be increasing numbers of devs getting themselves off on their "shiny 95% coverage" and patting themselves on the back for covering everything but the 5% of the codebase that actually needs thorough testing.

Oh, and that's ignoring the tests that just assert an exception isn't thrown, or don't assert anything at all. Completely bloody useless, but hey, you just carry on boasting how great all your tests are because you've got a higher coverage than the team next door 😤🙄

  • 1
    What about branch covering?

    Nohing against mutation testing though
  • 2
    I have never used code coverage as a valid metric.

    You can have 100% code coverage and still fail since just because both branches of the code was called, there might be lots of edge cases that trigger the wrong branch.

    If instead your test cover 95 % of the business rules we are in a but better shape.

    But that is so much harder to measure.
  • 1
    I guess it's mostly useful to see if you have useless code or untested code
Add Comment