Workshop: Test-Driven Development for Embedded C/C++

Test-Driven Development is an important design and problem solving technique that helps software developers improve product quality and the quality of their life. How? By preventing defects and by giving you warning when your design starts to deteriorate.

This tutorial describes the problems addressed by TDD, as well as the additional challenges and benefits of applying TDD to C, C++ and embedded software. This class is not just a show and tell. Bring your laptop with wifi access and a web browser. You will code.

You will experience the cadence of Test-Driven Development. You will see how it makes sure you know what your code is doing. We'll explore the benefits of test-driving your code. You will test-drive code with dependencies using open source tools CppUTest and CppUMock.

If you've heard of TDD and not tried it, this tutorial is a great place to discover what it is and how it can help you . Exercises are done on a custom version of hosted in the cloud. No computer setup is needed.

Embedded Software Developers
Software Developers
Technical team leaders
Managers that want to know more about the technology they manage (and ready to have some fun coding)

Some knowledge of C or C++
Bring a computer with a modern web browser
Exercises are done on a custom version of cyber-dojo

Course Outline

  • Test Driven Development
    • Why Test Driven Development?
    • What is Test Driven Development?
    • The Microcycle
    • Exercise
  • Adapting TDD to Embedded Software Development
    • Leveraging the Development System
    • Risks of Development System Unit Testing
    • Embedded TDD Cycle
    • Hardware/Platform Independence
  • Testable Designs
    • Object Oriented Principles Applied to C
    • TDD and Collaborating Modules - testing the code in the middle
  • Test Fakes, Stubs, Doubles, Mocks
    • Spying on the Hardware
    • Faking the Time
    • Link-time Fake
    • Exercise
  • Keeping Tests Clean
    • Test Smells
    • Tests as Detailed Documentation
    • Exercise
  • Test-Driving Next to the Silicon With Mock Objects
    • The Problem Solved by Mock Objects
    • TDD One Instruction Away from the Hardware
    • Exercise
  • Test-Driving With Mock Objects
    • The Problem Solved by Mock Objects
    • Setting Expectations
    • Exercise


James Grenning

TDD, Embedded, C++

Twitter: @jwgrenning

James Grenning trains, coaches and consults worldwide. His mission is to bring modern technical and management practices to embedded development teams. He is the author of Test-Driven Development for Embedded C. He is a contributor of CppUTest, a popular unit test harness for embedded C and C++. He invented Planning Poker, an estimating technique used around the world, and participated in the creation of the Manifesto for Agile Software Development. His website is