DEV Community

Discussion on: Why code coverage is not a reliable metric

Collapse
 
conectionist profile image
conectionist

Indeed, it doesn't show the quality.
Code coverage tools only tell you there are unit tests that cover SOME scenarios of a particular piece of code. But one unit test is rarely enough for the same code.
That's precisely the problem. Code coverage tools cannot tell you how "good" a unit test is. For that you need human logic or very strong artificial intelligence.
But tools that could do that would probably cost more than companies would be willing to invest in.

Collapse
 
rapasoft profile image
Pavol Rajzak

Yup, that's true, I was actually planning on developing some tool, that would indicate how "good" the tests are. It's not a silver bullet, but it should at least tell you things like:

  • the stub you've declared isn't used anywhere
  • the result you are receiving is not verified
  • there have been changes on some object without proper assertions, etc.

...and this list goes on, but I found it to be technically too challenging to just do it as a pet project :D.

Thread Thread
 
conectionist profile image
conectionist

That sounds cool.
Please consider sharing if you ever develop it.