fprime-component-unit-test
What it does
It guides the AI through planning and writing unit tests for a component's requirements, ports, events and commands. It is for engineers verifying F Prime flight software.
When to use it
- ✓When an F Prime component's implementation is ready and needs unit tests.
- ✓When you want unit tests written first, following test-first practice.
- ✓When you want high code coverage for an F Prime component.
Skill link
https://github.com/nasa/fprime/blob/devel/.github/skills/fprime-component-unit-test/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Can you write unit tests for this F Prime component that cover each requirement?”
5 new skills a week. 1 minute to read.
How it works
The AI sets up the test harness, writes tests for each requirement and interface, runs them and aims for high coverage, using rule-based tests where they fit.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Skill: F Prime Component Unit Testing
Unit tests verify each component requirement in isolation using the
autocoded test harness. This skill provides lifecycle context and
goals; for scaffolding, assertion macros, code patterns, and the full
implementation procedure, see fprime-unit-testing and the
unit testing guide.
Goals
- Verify all requirements with unit tests if possible.
- Verify all interfaces: ports, events, telemetry, commands.
- Prefer rule-based testing where possible — it provides broader
coverage than traditional tests. See
fprime-unit-testing§3 for criteria and constructs, and the rules-based testing guide for the full walkthrough. - Target 95% code coverage.
- You should be able to do most of this without user input, since requirements and the FPP model are already defined. However, ask the user for help with predicting edge cases you may have missed or for clarification on expected behavior.
Process
Follow fprime-unit-testing for the step-by-step procedure:
scaffold → implement → register → run. That skill covers Tester
class structure, TestMain layout, CMakeLists registration, assertion
macros, helper functions, and rules-based testing.
Key decisions within the lifecycle:
- Traditional vs. rule-based: Use the criteria table in
fprime-unit-testing§3. Default to rule-based for components with multiple ports or stateful behavior. - TDD: If following test-driven development (tests before implementation), see TDD guide. The FPP model is sufficient to write tests — implementation is not required.
- Coverage: Run
fprime-util check --coverageand review*_gcov.txt. Target 95%.
Anti-Patterns
- Testing only happy paths — off-nominal coverage is critical
- Forgetting
doDispatch()for async commands/ports - Asserting only on count (
SIZE) without checking values - Modifying component internals directly (test through the interface only)
- Guessing expected values — derive from requirements
FAQ
What coverage goal does it set?
It targets 95 percent code coverage.
What is rule-based testing?
It is an approach the skill prefers where possible, because it provides broader coverage than traditional hand-written tests.
Does it need my input?
Mostly no, but it asks you for help with expected behavior and edge cases it might miss.
Details
Original description by the author
Unit testing phase of F Prime component development. Provides lifecycle context, goals, and decision criteria for the unit testing phase. Defers to fprime-unit-testing for implementation details. Trigger when implementation is ready for testing or when following TDD (tests before implementation). Keywords: F Prime, unit test, GTest, TesterBase, GTestBase, Tester, fprime-util check, STest, rule-based testing.
repo: nasa/fprime
Popularity
- GitHub stars
- 12k
- Ranking position
- #11499
- License
- Apache-2.0
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
fprime-cmake-build-system
12kHelps your agent add modules, build targets and platform settings to an F Prime flight software project through its CMake layer.
fprime-component-design-fpp
12kHelps your agent turn approved F Prime component requirements into an FPP model of its ports, commands, events and telemetry.
fprime-component-development
12kHelps your agent guide an F Prime component through each development phase, from requirements to integration testing.
fprime-component-implementation
12kHelps your agent write the C++ code behind an F Prime component's generated handler functions, following the project's rules.
Similar skills
test-driven-development
311kTeaches your agent to write a failing test first, watch it fail, then write the smallest code that passes, before building any feature or fix.
verification-before-completion
311kTeaches your agent to run real checks and read their output before claiming that a task, fix, or build is complete or passing.
migrate-to-shoehorn
310kReplaces risky type casts in your test files with the shoehorn library, so tests can use partial data and still pass type checks.