Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Hazarth9478144dmaybe because 100% coverage is a bit of an overkill.
I find that tests are most useful if they comprehensively test the limits of a function or an entire flow, but not necessarily the code itself line-by-line. Your functions should have semantic meaning with a proper name like "find_value(container)" but your tests should worry about the implementation details of how that is done. They should just check if you can in fact find a value in common containers that are expected to be supported. If it supports more doesn't matter, if it checks for types and does something special doesn't matter, whether it looks into a database or enriches the data doesn't really matter as long as it find the value it's passing the test. thinking about code semantically helps to keep it clean. This is why TDD is such a good idea on paper, you will end up with semantic unit tests rather than codelock. -
MammaNeedHummus4416142dRe OP's post:
Because "100% test coverage" isn't real and the levels you need vs. strive for aren't the same.
It's an "asymptotic goal" - you shouldn't try to cover every case ever possible, just the important ones.
What are the important ones? Mob with your team and decide for yourselves
So I wrote some tests, 100% coverage on all the changes I've made. But for some reason, it all just feels useless. What is this I'm feeling?
rant