Hacker News new | ask | show | jobs
by adastra22 248 days ago
> pytest - Comprehensive test suite (80% coverage minimum)

Why would this ever be less than 100%?

1 comments

It's configurable. The minimum quality gate check is set at 80% here: https://github.com/CuriousLearner/django-keel/blob/main/temp...

Also, to answer why ever be less than 100% is that it depends. Usually, I prefer writing behavioural & integration tests, over chasing per-line coverage which might give a false confidence.

I'm not saying getting 100% coverage is bad, but with my experience working on several different projects, I've seen that the last 10-20% is usually low-value surface.

For critical modules like auth, money, policies (business-logic), should aim at close to > 95%.

When you reach that 100% mark, in my opinion, you might have to write brittle tests which slows down your refactoring with little risk reduction.

Again, to summarize, it's not a black/white answer on having 100% or no coverage, but this differs from project to project, and generally having anything above 80% that covers the core-business logic of projects tends to work in my opinion.

It was not at all clear to me that number was for code coverage. It sounded like it was permitting up to 20% of tests to be failing.
Interesting. Do you have any opinion on what this should be rephrased to, so that it's clearer?
Explicitly say code coverage or lines of code?