Executive Summary
Embedded C++ applications often rely on multiple components, including C APIs, operating system services, messaging systems, and hardware interfaces. These dependencies can make unit testing challenging, as tests may become slow, difficult to maintain, or dependent on specific hardware and environments.
This white paper explores how to isolate application business logic from external dependencies to build reliable and predictable unit tests for embedded C++ applications running on Zephyr RTOS. It explains how dependency injection, GoogleTest, GoogleMock, and the Fake Function Framework (FFF) can help developers test application behavior without relying on actual platform components.
It also covers ways to isolate Zephyr and operating system dependencies, test success and failure scenarios, and organize test code effectively. It clarifies the roles of unit, integration, and hardware testing, helping engineering teams understand how these approaches complement one another in validating embedded software. Designed for embedded software engineers, C++ developers, and test engineers working with Zephyr-based systems.
Key Highlights
- Embedded Unit Testing Challenges
- Business Logic Isolation
- Dependency Injection
- GoogleTest for Unit Testing
- GoogleMock for C++ Dependencies
- FFF for C Functions
- Zephyr OS Dependency Isolation
- Success and Failure Testing