We Have Existing Code

Most of you reading this book have an existing product code base you work with day in and day out. Most likely you have few or no automated unit tests. Does that mean you cannot do TDD? Of course not. Do you need to write tests for all your existing code before you begin? Come on, be serious. It would be great to have the unit tests, but it is not practical to write them all after the fact, stopping product development.

The recommended prescription for legacy code (code without tests) is to incrementally add tests while delivering new product functionality. We’ll look at this topic in detail in Chapter 13, Adding Tests to Legacy Code . As a brief preview, here are the techniques for adding tests and getting TDD going ...

Get Test Driven Development for Embedded C 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.