Skip to main content

Code Coverage

Leaders have relentlessly high standards — many people may think these standards are unreasonably high. Leaders are continually raising the bar and drive their teams to deliver high quality products, services, and processes. Leaders ensure that defects do not get sent down the line and that problems are fixed so they stay fixed.

Code Coverage for a service (focus on tests)​

Situation:​

  • Services all have automated analysis tools. One tool was showing that there were inadequate tests for a service. However, to save time, many developers just overrode the check so that they didn't need to add tests. There were some SEVs which could've been prevented by better unit tests.

Task:​

Lower the rate of SEVs (lets say 1 a week)

Action:​

  • Decided to raise the coverage and only allow overrides in extreme cases. Code reviews, etc
  • More unit tests! (mocks and integration tests as well, db script)
  • Integration tests
  • Deal with autogenerated code (i.e. sqlc)

Result:​

  • Decreased SEVs? Hard to tell - the rate did go down but let's acknowledge reality that it wasn't just due to raising unit test coverage
  • Potentially slowed down (tradeoff)

Reflection:​

  • Its a fine line between quality and speed. "Move fast and break things". Each team needs to find the sweet spot in relation to other teams that they rely on or teams that rely on them (upstreams and downstreams)

5 Whys:​

  • uwu

Q&A:​

  • uwu