News for hackers. Stuff that matters.
Re:The Big TDD Misunderstanding by necovek on Monday March 21, 2022 @10:22AM (#30754464)
100% coverage measured by lines of code being hit is actually insufficient for proper test coverage (which is what most, if not all tools that measure code coverage do).

It's easy to get "100% code coverage" for the below function:

  def nths(number: int, divisor: int) -> float:
      return number/divisor

  def test_nths():
      assert nths(1, 1) == 1
Yet it's obvious that test is not really taking care of anything.

What you need is 100% semantic coverage, i.e. your tests should cover all potential outcomes of the code at appropriate levels.

There are no comments on this comment yet.