Jump to ratings and reviews
Rate this book

Test Driven Development for Embedded C (Pragmatic Programmers) by James W. Grenning

Rate this book
TDD is a modern programming practice C developers need to know. It's a different way to program---unit tests are written in a tight feedback loop with the production code, assuring your code does what you think. You get valuable feedback every few minutes. You find mistakes before they become bugs. You get early warning of design problems. You get immediate notification of side effect defects. You get to spend more time adding valuable features to your product. James is one of the few experts in applying TDD to embedded C. With his 1.5 decades of training, coaching, and practicing TDD in C, C++, Java, and C# he will lead you from being a novice in TDD to using the techniques that few have mastered. This book is full of code written for embedded C programmers. You don't just see the end product, you see code and tests evolve. James leads you through the thought process and decisions made each step of the way. You'll learn techniques for test-driving code right next to the hardware, and you'll learn design principles and how to apply them to C to keep your code clean and flexible. To run the examples in this book, you will need a C/C++ development environment on your machine, and the GNU GCC tool chain or Microsoft Visual Studio for C++ (some project conversion may be needed).

Paperback

First published November 25, 2010

93 people are currently reading
372 people want to read

About the author

James W. Grenning

3 books3 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
109 (49%)
4 stars
78 (35%)
3 stars
28 (12%)
2 stars
3 (1%)
1 star
4 (1%)
Displaying 1 - 17 of 17 reviews
Profile Image for Nikos Alexo.
17 reviews1 follower
October 31, 2021
Working at a place without any formal testing process I picked up this book to learn more about testing. Book is not only about testing it has great tips about software engineering in general. I plan on returning to this book when I start my next project.
Profile Image for David Lindelof.
44 reviews19 followers
September 25, 2011
Easily one of my best 5 books on C. The title is slightly misleading; it's true that the author discusses some aspects of embedded development, but the lessons learned in this book are far more applicable than just the embedded world. It's basically a how-to manual for doing TDD in C, including discussions on design best practices.

I would have appreciated some detailed instructions on how to setup the CppUTest unit-testing framework, all the more so since the official documentation is very spartan. It took our team a couple of days to understand how to use it. But ever since then, we can state that all our new production code gets written tests for it first, and that's thanks to this book.

Highly recommended.
Profile Image for Jupp.
7 reviews
February 29, 2012
Awesome read, a real eye-opener for me and probably one of the best introductions to the subject. I really like how James Grenning sticks with the TDD cycle. It feels weird at first but the implications on your code design become obvious and the reader is amply rewarded in the later chapters. I'd love to know the author's opinion on other test frameworks like google test, though.
Profile Image for Ivan.
3 reviews1 follower
October 30, 2013
This book changed my mind about programming. TDD helps keep programming process under control.
Profile Image for James MacMillan.
1 review
March 7, 2015
Well worth the time. Very accessible and insightful. I am integrating these ideas and practices into my daily work already.
Profile Image for Tim Verstraete.
314 reviews4 followers
March 3, 2018
This has to be one of the best technical books I have read ... clear, concise, to the point, good examples, well written AND interesting topic. Nice!
31 reviews1 follower
August 28, 2022
Old time practitioner of TDD for application as well as embedded/dedicated systems but for some reason never got around to reading this book until now, some 10+ years after publication.
If you're an application level programmer getting into embedded this book will contain a lot of repetition but the examples and descriptions of how to deal with test doubles/mocks etc for embedded and legacy embedded code is worth the read.
If you are embedded programmer not used to TDD this book is a gem.
Th only thing I would have liked to see more of is discussion about hard hard to test embedded stuff like interrupt and concurrency.
Overall, absolute gem of a book. The compact description/summary of Michael Feathers work on legacy code is brilliant. I think everyone should read Feathers but if you don't have the time, Grenning's book contains a nice summary.

Final thoughts, if you read this one - also check out Grenning's ZOMBIES acronym for unit test
Profile Image for Henrik.
21 reviews1 follower
December 11, 2019
A structured and concrete introduction and tour of Test-Driven Development for embedded systems and programming in general.

The author manages to demonstrate the benefits of a TDD approach to implementing embedded systems. This turns out to be especially relevant, since embedded systems typically have a special toolchains and only target specific platforms; TDD (at least the approach) forces the software engineer to make a slightly more abstract and device independent implementation. The benefit, which is then clearly demonstrated is that testing in the manner needed for TDD can more fully explore the failure modes of production code: how can peripherals and random events be tested?

The argument is that TDD forces the programmer to implement the necessary abstractions which allow for testability and this in turn increases the confidence in the program code.
Profile Image for Tyler.
87 reviews
September 7, 2024
This book accomplishes exactly what it sets out to. I already have a fair bit of exposure to TDD but nevertheless found this to be an enjoyable read full of good reminders. It reinforced the importance of the 4-phase test pattern, and I especially liked the discussion around TDD and design patterns - code has to be somewhat modular in order to be easily testable.

Reading this also reminded me how fortunate I am to be able to work with C++. Hah! It was a bit painful being reminded of all the hoops you have to jump through to try mimicking object-oriented programming in C.
33 reviews
February 9, 2019
Grenning presents a unit testing methodology of programming in this book that is tailored towards embedded development. The first part of the book was the most valuable, with an overview of what test-driven development (TDD) is and why he considers TDD to be of value in software development. He covers some of the unique challenges of using TDD with the C language and work arounds for these issues. Overall, this is a great reference with plenty of examples on how to begin using TDD.
Profile Image for Birdy Toh.
3 reviews
May 25, 2020
Definitely a recommended, since books on embedded development is already rare
Profile Image for Michal Ormoš.
43 reviews
January 1, 2021
A good intro to the technique, which I was looking for. I already practiced several examples. Written in a good manner. Clear descriptions and examples of frameworks. But the reader needs to have basic awareness of FW development in TDD to apply it to his problems.
1 review
Currently reading
January 9, 2019
Excellent work. One of the best titles in the pragmatic programmer series. It is very well written, easy to read and strikes the right balance between theory and practice. It made me change the way I work and I recommend it to embedded software engineers and their management chains.
Displaying 1 - 17 of 17 reviews

Can't find what you're looking for?

Get help and learn more about the design.