ormus-solutions/libreembed-claude-code/embedded-testing-patterns
- community
Checking that the SKILL.md file is still in the repository.
Firmware test patterns with Unity, CMock, Ceedling, and QEMU: project layout, testable HAL interfaces, CMock expect chaining, error-path tests, and an on-target test runner over ITM. Use when making embedded C testable or writing tests for it.
Install
npx vskill@latest install ormus-solutions/libreembed-claude-code/embedded-testing-patternsSKILL.md
embedded-testing-patterns
Knowledge Base
Embedded C test patterns using Unity, CMock, Ceedling, and QEMU.
Pattern 1: Ceedling Project Structure
Minimal project.yml:
Run:
Pattern 2: Testable HAL Interface Pattern
The golden rule: drivers never call HAL_I2C_Master_Transmit directly. They call through a pointer.
Production: pass a &stm32_i2c_ops that wraps HAL_I2C_Master_Transmit. Test: pass a &mock_i2c_ops backed by function pointers set by CMock.
Pattern 3: CMock Expect Chaining
Order matters. CMock verifies calls happen in declared order when enforce_strict_ordering: TRUE.
If fewer calls happen than expected, CMock fails with "Called fewer times than expected."
Pattern 4: Testing Error Paths
Error path coverage is often the most valuable. Always inject failures.
Pattern 5: On-Target Test Runner via ITM
For tests that must run on hardware (timing-sensitive, peripheral integration):
Output captured via J-Link SWO Viewer or OpenOCD SWO. Pass/fail visible on host.
Anti-Patterns
- Testing HAL calls instead of business logic: mock the HAL, test what your code does with the result.
- Global state between tests: reset all static variables in
setUp(). Static state leaks cause false passes. - Single large test per function: one test should test one behavior. Refactor to separate
test_X_when_Y. - Ignoring all mock calls with `_IgnoreAndReturn`: fine for stubs, but hides regressions. Be explicit.
References
- Unity source + docs: https://github.com/ThrowTheSwitch/Unity
- CMock: https://github.com/ThrowTheSwitch/CMock
- Ceedling: https://github.com/ThrowTheSwitch/Ceedling
- James Grenning, "Test-Driven Development for Embedded C" (Pragmatic Bookshelf)
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/embedded-testing/skills/embedded-testing-patterns/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ormus-solutions/libreembed-claude-code/embedded-testing-patterns)