3 ms·
Coverage isn't the goal. The goal is understanding. Write a test if you don't feel confident that a piece of code does what you think it does. If you're not su
by michaelfeathers 9y ago
Coverage isn't the goal. The goal is understanding.
Write a test if you don't feel confident that a piece of code does what you think it does. If you're not sure what it does now, there's little chance that you or anyone else will in the future, so write a test to understand it and to make that understanding explicit.
Use curiosity as a driver.
- sAbakumoff 9y agoAlso, the code of a test could be used as the documentation. Just recently I started using bleve(https://github.com/blevesearch/bleve https://github.com/blevesearch/bleve). Documentation is quite poor, but I was able to learn the product entirely from the code of its unit tests. That's not normal though.