Mocking the Embedded World: Test-Driven Development, Continuous Integration, and Design Patterns
Despite a prevalent industry perception to the contrary, the agile practices of test-driven development and continuous integration can be successfully applied to embedded software. This paper presents a holistic set of practices, platform independent tools, and a new design pattern (Model Conductor Hardware, or MCH) that together produce: good design from tests that are programmed first, logic decoupled from hardware, and systems testable under automation. Ultimately, this approach yields an order of magnitude or more reduction in software flaws, predictable progress, and measurable velocity for data-driven project management. We use the approach discussed herein for real-world production systems and have included a full, C-based sample project (using an Atmel AT91SAM7X ARM7) to illustrate it. This example demonstrates transformation of requirements into test code, system, integration, and unit tests driving development, daily "micro design" fleshing out a system's architecture, the use of the MCH itself, and the use of mock functions in tests.