3

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?

Comments
  • 0
    Ennui
  • 0
    Not sure if sarcasm but…
    Yes, it is useless.
  • 2
    maybe 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.
  • 0
    Re 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
Add Comment