3 ms·
This is a big topic, and you're asking some good questions. Rather than tackle it all, I can recommend expanding your questions with the following. When someon
by aazaa 7y ago
This is a big topic, and you're asking some good questions. Rather than tackle it all, I can recommend expanding your questions with the following.
When someone tells you they don't write tests first, ask them how they refactor. How do they know the changes they made didn't break anything?
You can fool yourself with test-first, but it's quite difficult to do if you're rigorously following the practice. First write a failing test. Next, write only enough production code to fix the failing test. Optionally refactor. Rinse and repeat.
Code created this way can prove that every line of production code resulted from a failing test. Nothing is untested, by definition. The code may be incomplete due to cases not considered, but everything present has been tested. Note that it's possible to break this guarantee by writing production code unnecessary to get the test to pass.