Chuyển đến nội dung
Skillpedia
Kiểm thử12k · #11499

fprime-component-unit-test

Skill này làm gì

Skill hướng dẫn AI lập kế hoạch và viết kiểm thử đơn vị cho các yêu cầu, port, sự kiện và lệnh của thành phần. Dành cho kỹ sư kiểm chứng phần mềm bay F Prime.

Khi nào nên dùng

  • ✓Khi phần triển khai của một thành phần F Prime đã sẵn sàng và cần kiểm thử đơn vị.
  • ✓Khi bạn muốn viết kiểm thử đơn vị trước, theo thực hành test-first.
  • ✓Khi bạn muốn đạt độ phủ mã cao cho một thành phần F Prime.

Liên kết skill

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

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/nasa/fprime/blob/devel/.github/skills/fprime-component-unit-test/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Bạn có thể viết kiểm thử đơn vị cho thành phần F Prime này, bao quát từng yêu cầu không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

AI thiết lập khung kiểm thử, viết kiểm thử cho từng yêu cầu và giao diện, chạy chúng và nhắm tới độ phủ cao, dùng kiểm thử dựa trên quy tắc (rule-based) khi phù hợp.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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
Câu hỏi thường gặp

Skill đặt mục tiêu độ phủ là bao nhiêu?

Skill nhắm tới 95 phần trăm độ phủ mã.

Kiểm thử dựa trên quy tắc là gì?

Đó là cách tiếp cận skill ưu tiên khi có thể, vì nó bao quát rộng hơn các kiểm thử viết tay truyền thống.

Skill có cần đầu vào của tôi không?

Phần lớn là không, nhưng skill sẽ hỏi bạn về hành vi mong đợi và các trường hợp biên mà nó có thể bỏ sót.

Chi tiết

Mô tả gốc của tác giả

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

Độ phổ biến

Sao GitHub
12k
Vị trí xếp hạng
#11499
Giấy phép
Apache-2.0
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự