Member-only story

Green from the outside, but red inside. — Further than 80% code coverage

Kong To
5 min read1 day ago

Why chasing after 100% ?

Green from outside, red inside

In my previous posts, we discussed about the need of the Quality Gate, that is a meant to enforce code quality. Many companies usually set a threshold with a minimum of around 80% code coverage. Then why not 100%?

Well, it’s just a matter of cost. It would mean that developers must spend more time writing tests than writing production code.

Moreover, could we really detect every corner case or any functional or technical issue event with a code coverage close to 100%? Of course not, things could still be undetected.

That is green from outside, but red inside

In my team, the coverage is around 85%. Developers have done quite a good job on that matter. However, there are many weak points. Some tests are meaningless, but only to have coverage. That is what has been done so far before I joined the team.

The green is only to have coverage pass the Sonar Quality Gate, but it is still red inside.

That is just waste of time. On the other hand, having relevant tests helps teams to be more efficient in delivering features faster. For example, with all the automated…

--

--

Kong To
Kong To

Written by Kong To

Architect, Engineer, Developer, Code, Code Crafter... whatever but code quality matters

No responses yet