Re:Unit Testing Is Overrated
by shawnz on Thursday July 09, 2020 @08:22AM
(#23779388)
Even with 100% coverage, that doesn't mean you've found every bug that can possibly be found with unit tests. Your tests could always cover more inputs, more situations, etc.
[ Parent
| on HN ]
Re:Unit Testing Is Overrated
by KingOfCoders on Thursday July 09, 2020 @08:32AM
(#23779468)
No, you can't find bugs that you can't think of.
Property based testing and random values in unit tests find lots of bugs you didn't think of though.
> you can't find bugs that you can't think of
Rather, you won't find bugs that you choose not to think of because you've let the "100%" number lull you into complacency, even though you know it's 100% of lines/branches, not 100% of inputs.
Re:Unit Testing Is Overrated
by KingOfCoders on Thursday July 09, 2020 @09:59AM
(#23780296)
Yes.
My problem in 40y of programming is still making bugs and those I make come from not thinking about edge cases or from wrong assumptions and not from being lulled into writing tests to meet a 100% number.
But personalities differ and if being lulled into security by writing towards a 100% number is a problem for you I would be careful, I totally agree here.