14 ms·
At home, I only test parts of code where I think I need it, like regexes. At work, as a web developer in Java Spring, I am required to have at least 80% covera
by rpigab 3y ago
At home, I only test parts of code where I think I need it, like regexes.
At work, as a web developer in Java Spring, I am required to have at least 80% coverage, enforced by Jacoco and tracked in Sonar. This means that if I write a method in an adapter that accepts a single parameter and only makes a single call to another method on some repository passing the parameter to it without transformation and returning the result, I must write a test for it, with Mockito.
At this point I'm not testing my code, I'm testing the Java API itself and the JVM it's running on, which I find hilarious. I'm hoping one day this kind of test fails, which will mean that Java does not garantee that reaching a method call will result in a method being called.
- CuriouslyC 3y agoTest coverage requirements are such a band-aid on bad engineering culture. Just instruct reviewers to look at the coverage during code review and flag uncovered important business logic, *BOOM* problem solved. If you can't trust your code reviewers to do this, that's a sign they're either lazy or incompetent.
- rpigab 3y agoAlso, Goodhart's law.