Chapter 14. Test-driven Development—Classic Style

Test-driven development (TDD) is the practice of driving the design of code with tests. In contrast to the traditional “write code – verify code” workflow, TDD mandates that the first task in any development undertaking be to write a test. Only then can the code that will make that test pass be written. If faithfully applied, no production code will ever come into existence unless it’s preceded and accompanied by at least one test. This doesn’t “auto-magically” guarantee correctness of the code, and many people would claim that TDD has nothing to do with testing. That said, test-driven code is, by definition, testable, and after reading the opening paragraphs of Chapter 4, “Testability from a ...

Get Developer Testing: Building Quality into Software now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.