Avoiding Future Defects and Documenting Codes
Learn how TDD helps prevent defects and ensures clear code documentation in the development process.
Growing code in development can cause major defects in future productions if proper protection measures are ignored. Let's examine how we can protect our code from future major defects.
Protecting against future defects
As we grow our code by writing tests first, we could always simply delete each test after it has passed. We’ve seen some students do that while teaching them TDD because we hadn’t explained that we shouldn’t do that yet. Regardless, we don’t delete tests once they pass. We keep them all. Tests grow into large regression suites, automatically testing every feature of the code we have built. By frequently running all the tests, we gain safety and confidence in the entire code base.
Adding new features
As team members add features to this code base, keeping all the tests passing shows that nobody has accidentally broken something. It is quite possible in software to add a perfectly innocent ...