Skip to content
Skillpedia
Testing12k · #11499

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.md

Copy 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

Use this skill to help me: https://github.com/nasa/fprime/blob/devel/.github/skills/fprime-component-unit-test/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

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:

  1. 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.
  2. TDD: If following test-driven development (tests before implementation), see TDD guide. The FPP model is sufficient to write tests — implementation is not required.
  3. Coverage: Run fprime-util check --coverage and 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

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills