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.mdSao 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
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
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:
- 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. - TDD: If following test-driven development (tests before implementation), see TDD guide. The FPP model is sufficient to write tests — implementation is not required.
- Coverage: Run
fprime-util check --coverageand 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
Bình luận
- …
Thêm skill từ kho mã này
fprime-cmake-build-system
12kGiúp agent của bạn thêm module, build target và cài đặt nền tảng vào dự án phần mềm bay F Prime thông qua lớp CMake của nó.
fprime-component-design-fpp
12kGiúp agent của bạn chuyển các yêu cầu thành phần F Prime đã được duyệt thành mô hình FPP cho các port, lệnh, sự kiện và telemetry.
fprime-component-development
12kGiúp agent của bạn hướng dẫn một thành phần F Prime qua từng giai đoạn phát triển, từ yêu cầu đến kiểm thử tích hợp.
fprime-component-implementation
12kGiúp agent của bạn viết mã C++ phía sau các hàm xử lý được sinh tự động của một thành phần F Prime, theo đúng quy tắc của dự án.
Skill tương tự
test-driven-development
311kDạy agent của bạn viết kiểm thử thất bại trước, xem nó thất bại, rồi viết đoạn mã ngắn nhất để vượt qua trước khi làm bất kỳ tính năng hay bản sửa nào.
verification-before-completion
311kDạy agent của bạn chạy kiểm tra thực tế và đọc kết quả đầu ra trước khi khẳng định một việc, bản sửa hoặc bản build đã hoàn thành hay vượt qua.
migrate-to-shoehorn
310kThay các ép kiểu rủi ro trong tệp kiểm thử bằng thư viện shoehorn, để các bài kiểm thử dùng dữ liệu một phần vẫn qua được kiểm tra kiểu.