3 ms·
> Am I suggesting 100% test coverage? No, I’m not suggesting it. I’m demanding it. Every single line of code that you write should be tested. Period. This is f
by abhashanand1501 10mo ago
> Am I suggesting 100% test coverage? No, I’m not suggesting it. I’m demanding it. Every single line of code that you write should be tested. Period.
This is from uncle bob. I hate the argument by people that 100% leads to "bad quality tests". Not doing it leads to bad quality code, people who don't care about quality of code, and hence dont write tests, suddenly start to care about quality of tests.
- imtringued 10mo ago100% means testing things getters and setters in Java. At some point you're testing nothing. If you tell people that 95% is just as inadequate as 0%, they'll tend towards 0%.
- abhashanand1501 10mo agoThere are two possibilities 1. The getters and setters are not called anywhere in application logic. In that case, delete the getters / setters and get to 100%. 2. The getters and setters are called somewhere in the application logic. In that case, they should have already been covered in the test for the application. There is really no excuse to not write tests to get to 100%.
- mystifyingpoi 10mo ago> The getters and setters are not called anywhere in application logic It's common that getters and setters will be called by serialization library. The fact that they are "grey" in IntelliJ doesn't matter.
- redhale 10mo agoOn literally every project I've seen that enforces a % threshold, that % threshold has directly led to bad quality tests. This is more true the higher the % is, with the worst being 100%. You can argue that it _shouldn't_ be this way, and I would agree, but it is that way. Perhaps in part because developers are humans, and even humans with the best initial intentions will game metrics with a large enough sample size over a long enough time horizon.