Testing vs. Test-Driving: Parameterized Tests and Other Toys

Despite the word test appearing in its name, TDD is less about testing than it is about design. Yes, you produce unit tests as a result of practicing TDD, but they are almost a by-product. It might seem like a subtle difference, but the true goal is to allow you to keep the design clean over time so that you may introduce new behavior or change existing behavior with high confidence and reasonable cost.

With a testing mentality, you seek to create tests that cover a breadth of concerns. You create tests for five types of cases: zero, one, many, boundary, and exceptional cases. With a test-driving mentality, you write tests in order to drive in code that you believe meets desired specifications. ...

Get Modern C++ Programming with Test-Driven Development 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.