Agent Skillsnasa/fprime › fprime-component-unit-test

fprime-component-unit-test

GitHub

提供F Prime组件单元测试的生命周期指导,涵盖验证需求、接口及95%覆盖率目标。支持TDD和基于规则的测试,指导从脚手架到运行的流程,并列出常见反模式。

.github/skills/fprime-component-unit-test/SKILL.md nasa/fprime

Trigger Scenarios

准备进行F Prime组件单元测试 遵循TDD方法编写测试

Install

npx skills add nasa/fprime --skill fprime-component-unit-test -g -y
More Options

Non-standard path

npx skills add https://github.com/nasa/fprime/tree/devel/.github/skills/fprime-component-unit-test -g -y

Use without installing

npx skills use nasa/fprime@fprime-component-unit-test

指定 Agent (Claude Code)

npx skills add nasa/fprime --skill fprime-component-unit-test -a claude-code -g -y

安装 repo 全部 skill

npx skills add nasa/fprime --all -g -y

预览 repo 内 skill

npx skills add nasa/fprime --list

SKILL.md

Frontmatter
{
    "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.


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

Version History

  • 7d8f579 Current 2026-08-20 11:33

Same Skill Collection

.github/skills/agent-skill-authoring/SKILL.md
.github/skills/ci-test-runtime-policy/SKILL.md
.github/skills/fprime-cmake-build-system/SKILL.md
.github/skills/fprime-component-design-fpp/SKILL.md
.github/skills/fprime-component-development/SKILL.md
.github/skills/fprime-component-implementation/SKILL.md
.github/skills/fprime-component-integration-test/SKILL.md
.github/skills/fprime-component-requirements/SKILL.md
.github/skills/fprime-ground-input-tracing/SKILL.md
.github/skills/fprime-hardware-input-tracing/SKILL.md
.github/skills/fprime-topology-development/SKILL.md
.github/skills/fprime-unit-testing/SKILL.md
.github/skills/jpl-design-principles/SKILL.md
.github/skills/maintainer-lookup/SKILL.md
.github/skills/post-inline-review/SKILL.md
.github/skills/pr-diff-scoping/SKILL.md
.github/skills/prompt-injection-precheck/SKILL.md
.github/skills/re-review-state/SKILL.md
.github/skills/triage-classifier/SKILL.md
.github/skills/write-system-functional-doc/SKILL.md
.github/skills/fprime-cpp-design/SKILL.md

Metadata

Files
0
Version
efce12d
Hash
5e96fb72
Indexed
2026-08-20 11:33

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-17 05:31
浙ICP备14020137号-1