Test Driven Development for Embedded C
Douban
James W. Grenning
overblik
Did you write C code last week? Does your code work? Is your design clean? If you answered yes to the first question but got queasy over the second two, you need to know about Test Driven Development. TDD helps you write code that works the first time, and then helps you keep it running as the code evolves to meet new needs.
In Test Driven Development for Embedded C, author James W. Grenning shows embedded software developers how to bring the benefits of TDD to embedded C.
In the book, you'll see how to apply TDD to C and the world of embedded software development. Learn how to break key dependencies, allowing code to be tested thoroughly. Explore how to test-drive your product's core logic, exploiting the power of your development environment to deliver better software.
In fact, as the book shows, you can test-drive a device driver before you even have the device soldered into a circuit board. Avoid the natural delays when testing on the target by using the tailored TDD Microcycle, employing off-target tests and dual-targeted code.
Learn how to make code testable and more flexible, better able to handle the inevitable changes demanded by the market. The tests drive development and then serve as an executable specification, keeping track of the critical details and assumptions baked into the code.
In Test Driven Development for Embedded C, you'll find that TDD is a different way to program-unit tests are written in a tight feedback loop with the production code, producing testable code and greatly reducing wasteful debugging. TDD also influences design. When tests are considered part of design, you create modular and loosely coupled code, the hallmarks of a good design.
With Test Driven Development for Embedded C, C developers-even embedded C developers-can finally write cleaner, testable code with TDD.
contents
Test Driven Development
Getting Started
Test Driving Tools and Conventions
Starting a C Module
Testing Your Way to Done
Embedded TDD Strategy excerpt
Yeah but…
Testing Modules with Collaborators
Introducing Test Doubles
Spying on the Production Code excerpt
Function Pointer Test Doubles
The Mock Object
Design and Continuous Improvement
SOLID Testable Designs in C
Refactoring
Adding Tests to Legacy Code
Test Guidelines
Stuff at the End
Glossary
Development System Test Environment
Resources
Guide to UML Used in this Book
CppUTest Quick Reference
Code Examples Appendix
LedDriver After the First 3 Tests