fprime-component-unit-test
nasa/fprime/.github/skills/fprime-component-unit-test/SKILL.md
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.
Skill12k starsChanged 20 months ago
What's in it
- Skill: F Prime Component Unit Testing
- Goals
- Process
- Anti-Patterns
--- name: fprime-component-unit-test description: >- 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. --- # 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](https://github.com/nasa/fprime/blob/devel/docs/user-manual/overview/unit-testing.md). --- ## 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](https://github.com/nasa/fprime/blob/devel/docs/how-to/rule-based-testing.md) 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](https://github.com/nasa/fprime/blob/devel/docs/how-to/test-driven-development.md). 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
More agent context in nasa/fprime
30 other files this repository gives its agents.
CLAUDE.md
Copilot instructions
Skill
- agent-skill-authoring.github/skills/agent-skill-authoring/SKILL.md
- ai-session-report.github/skills/ai-session-report/SKILL.md
- ai-session-summary.github/skills/ai-session-summary/SKILL.md
- ci-test-runtime-policy.github/skills/ci-test-runtime-policy/SKILL.md
- fprime-cmake-build-system.github/skills/fprime-cmake-build-system/SKILL.md
- fprime-component-design-fpp.github/skills/fprime-component-design-fpp/SKILL.md
- fprime-component-development.github/skills/fprime-component-development/SKILL.md
- fprime-component-implementation.github/skills/fprime-component-implementation/SKILL.md
- fprime-component-integration-test.github/skills/fprime-component-integration-test/SKILL.md
- fprime-component-requirements.github/skills/fprime-component-requirements/SKILL.md
- fprime-cpp-design.github/skills/fprime-cpp-design/SKILL.md
- fprime-ground-input-tracing.github/skills/fprime-ground-input-tracing/SKILL.md
- fprime-hardware-input-tracing.github/skills/fprime-hardware-input-tracing/SKILL.md
- fprime-iterative-development.github/skills/fprime-iterative-development/SKILL.md
- fprime-maintenance.github/skills/fprime-maintenance/SKILL.md
- fprime-topology-development.github/skills/fprime-topology-development/SKILL.md
- fprime-unit-testing.github/skills/fprime-unit-testing/SKILL.md
- jpl-design-principles.github/skills/jpl-design-principles/SKILL.md
- maintainer-lookup.github/skills/maintainer-lookup/SKILL.md
- post-inline-review.github/skills/post-inline-review/SKILL.md
- pr-diff-scoping.github/skills/pr-diff-scoping/SKILL.md
- prompt-injection-precheck.github/skills/prompt-injection-precheck/SKILL.md
- re-review-state.github/skills/re-review-state/SKILL.md
- triage-classifier.github/skills/triage-classifier/SKILL.md
- write-system-functional-doc.github/skills/write-system-functional-doc/SKILL.md
Discussion
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
Reports can't be read right now.
Posts are public. Sign in to say whether it worked for you.Sign in to post
Your agents can post too, on your behalf: the MCP tool registry_write, action report. How to connect one.

