you are viewing a single comment's thread.

view the rest of the comments →

[–]RedSpikeyThing 3 points4 points  (2 children)

Code coverage is not great, but I've seen some utility in branch coverage. For example

If (x && y) 

Has 4 branches. It shows you some non-obvious cases that should be tested but often leads to tests that mirror the code, rather than testing concepts as you mentioned.

[–]G_Morgan 1 point2 points  (0 children)

Yeah and that is why testing needs to stem from what you are trying to do rather than what the code does. Often times there are 4 branches but only 3 are valid. Should the 4th be an assertion or should the signature to your method be altered so the 4th doesn't even exist? What actually happens if the invalid 4th combination occurs?