4 ms·
>Like, does anyone feel really good about saying there's good test coverage of a class with 50% code coverage? 60%? Depends. 20% might be enough too. You can j
by coldtea 12y ago
>Like, does anyone feel really good about saying there's good test coverage of a class with 50% code coverage? 60%?
Depends. 20% might be enough too. You can just test the 20% harder and more failure dependent paths in your app, not the 80% trivial BS code.
Remember the 80/20 rule?
- aetherson 12y agoI do remember it! I feel like having bugs in my code that is only run 20% of the time is not an acceptable amount of bugs. Like, seriously guys, I'm sure we can all come up with some kind of degenerate case where 80% of the code is in exception-handling or some other really, really, really rarely called piece of code, and feel okay with not testing that. But that's hardly the ordinary scenario. And, for example, in the messaging code I've recently been writing, it certainly is the case that some of the code is exercised a lot more than others. For example, reads are done an order of magnitude more than writes, and writes are done an order of magnitude more than deletes. But that doesn't make me feel okay about bugs in my delete code. It's a whole feature. It needs to work.
- coldtea 12y ago>I do remember it! I feel like having bugs in my code that is only run 20% of the time is not an acceptable amount of bugs. Then maybe you don't understand the notion of "opportunity cost". Perhaps you feel "0 is the only acceptable amount of bugs", but a) nobody cares for an imaginary bug-free product unless it ships. And shiping, for programs intended for the market, means cutting corners and, yes, shipping bugs too. b) programs that have 0 bugs are so few as to be statistical noise, including among TDD/full coverage programs. TDD will basically help you cover that the behavior you expect is happening and help you track breakage when you need to refactor. It wont eliminated all bugs. >But that doesn't make me feel okay about bugs in my delete code. It's a whole feature. It needs to work. Perhaps you conflated untested with "not working". People created succesful software for ages, software that changed the world, with no or less than 50% "test coverage".