本文へスキップ
Skillpedia
テスト12k · #11499

fprime-component-unit-test

できること

コンポーネントの要件、ポート、イベント、コマンドに対する単体テストを計画して書く手順を、AIに案内します。F Primeの飛行ソフトウェアを検証するエンジニア向けです。

使う場面

  • ✓F Primeのコンポーネントの実装が完成し、単体テストが必要なとき。
  • ✓テストファーストの方法で、単体テストを先に書きたいとき。
  • ✓F Primeのコンポーネントで高いコードカバレッジが欲しいとき。

スキルのリンク

https://github.com/nasa/fprime/blob/devel/.github/skills/fprime-component-unit-test/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/nasa/fprime/blob/devel/.github/skills/fprime-component-unit-test/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“各要件を確認するこのF Primeのコンポーネントの単体テストを書いてもらえますか。”

毎週5つの新しいスキル。1分で読めます。

仕組み

AIはテストハーネスを準備し、各要件とインターフェースのテストを書いて実行し、高いカバレッジを目指します。適した場合はルールベースのテストを使います。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)を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
よくある質問

カバレッジの目標はどれくらいですか?

95パーセントのコードカバレッジを目標にしています。

ルールベースのテストとは何ですか?

このスキルが可能な場合に推奨する手法で、従来の手書きのチェックより広く網羅できるとしています。

あなたの入力は必要ですか?

ほとんどは不要です。ただし、期待される動作や、見落としそうな端のケースについては手伝いを求めます。

詳細

作者による元の説明

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

人気

GitHubのスター
12k
ランキング
#11499
ライセンス
Apache-2.0
更新日
2026/11/2

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル