SPA Conference session: Full-On Test-Driven Development of Embedded Software

One-line description:Hands-on TDD of C and C++ examples using different unit test frameworks
Session format: Tutorial (150 mins) [read about the different session types]
Abstract:Test driven development (TDD) is a technique that emerged as one of the fundamental technical practices of Extreme Programming (XP). It is therefore often wrongly assumed that it can only be applied to Java and dynamic languages, but with the right framework I have found that it is equally applicable in just about any language - even graphical "languages" such as Datastage mappings.

In this tutorial, I want to provide an introduction to TDD for embedded software - typically written in C and C++ for device drivers, controllers and so on in sometimes very demanding environments (e.g. safety critical, real-time, or highly resource-constrained). The exercises will involve using frameworks such as Unity, CppUnit and CppUtest to develop a series of library components.

The techniques covered will include

- test case selection
- refactoring
- stubs
- mock objects

If time permits, we will also take a look at a couple of static analysis tools to see how these can complement the dynamic test frameworks.
Audience background:Basic familiarity with C and C++ or similar languages such as Java is assumed. Ideally, participants will be familiar with the Eclipse IDE.
Benefits of participating:Participants will know how to apply TDD to embedded software and have a feel for the "cadence" - how long it takes to go round the TDD loop once and how long to develop a fully working and tested component.
Materials provided:- Pre-installed Eclipse IDE with the tools required for the exercise
- Prepared example development tasks of increasing difficulty
- Model solutions
- References for further reading; where to obtain the tools
Process:After a brief introduction, participants will mainly work in pairs on the example exercises. I anticipate that the exercises will take progressively longer. There should be a short retrospective at the end of each.
Detailed timetable:00:00 - 00:10 - Introduction to TDD
00:10 - 00:15 - Presentation of first exercise (develop a C function)
00:15 - 01:00 - Work on first exercise
01:00 - 01:10 - Present results of first exercise

01:10 - 01:20 - Presentation of second exercise (develop a C++ class with mocks)
01:20 - 02:15 - Work on second exercise
02:15 - 02:25 - Present results of second exercise
02:25 - 02:30 - Sum up
Outputs:People will take the example projects away with them to use as templates in their work.

Interesting observations collected during the result presentations (if any) will be added to the conference wiki.
History:First presentation
1. Immo Hüneke
Zuhlke Engineering Ltd
2. 3.