DEV Community

100% test coverage: Why or why not?

Roelof Jan Elsinga on November 06, 2019

Photo by Carlos Alberto Gómez Iñiguez 100% test coverage: Why or why not? The magical moment is finally there, you've written the test...
Collapse
 
cyberhck profile image
Nishchal Gautam

If you just wrote a test and it put your coverage up to 100%, you didn't do TDD, from my own experience, most of the time when you write tests after code, the tests aren't as good.

Write tests first, let it fail, then code, then test again, you'll be almost always 100% covered, and your tests are better.

Collapse
 
roelofjanelsinga profile image
Roelof Jan Elsinga

Exactly my point! 100% test coverage is a tool, not the goal.