DEV Community

Discussion on: How much testing should cover

Collapse
 
pjeziorowski profile image
Patryk Jeziorowski

92% usually means that during tests program execution went (at least once) through 92% lines of source code.

So if your app has 1000 lines of code, 92% coverage means that during the test 920 lines of code were executed (one or more times), and 80 lines were not executed at all.

There is no magic number to answer question "what coverage % is the best".

You don't have to aim for 100%. Business logic should be tested, corner cases should be tested.

There are parts of code that do not have be tested - a good example could be getter/setter methods in Java. Testing them intentionally would provide no value, so 100% coverage is not a requirement for sure.