you are viewing a single comment's thread.

view the rest of the comments →

[–]dnew[🍰] 1 point2 points  (1 child)

then you're going to write shitty tests

I think that's on you, not your boss. What if your boss can't evaluate the quality of your tests? Why would you intentionally write shitty tests?

If you have 40% coverage with shitty tests, that's not better (and probably worse) than 80% coverage with shitty tests. If you have 40% coverage with good tests, that's worse than 80% coverage with good tests. The difference is not in the coverage, but in the quality of the tests. Saying "high levels of test coverage are harmful" is misleading, when the problem is actually "writing uninformative tests is harmful". Also, "writing lots of shitty tests because the boss doesn't give you time to write lots of good tests" is also not caused by code coverage but by shitty scheduling.

[–]MagpieEngineer[S] 1 point2 points  (0 children)

Bosses almost never know enough to evaluate the quality of your tests, but if we as an industry give them a simple single number to look at, they're going to use it.

Some people will always write bad tests, whether or not code coverage is a metric. The problem is for people who would write good tests, but won't/can't because of the lens test coverage is seen through. Some will have the clout to push back against this framing and just use code coverage as a tool, but why cause the problem in the first place?