fprime-component-integration-test
它能做什么
它指导 AI 编写集成测试,通过地面系统发送命令,并检查事件和遥测。适用于测试 F Prime 组件的工程师。
适用场景
- ✓当单元测试通过,F Prime 组件需要进行集成测试时。
- ✓当你希望测试能向正在运行的 F Prime 部署发送命令时。
- ✓当你需要在实时系统中检查组件的事件和遥测时。
技能链接
https://github.com/nasa/fprime/blob/devel/.github/skills/fprime-component-integration-test/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请编写 pytest 集成测试,为这个 F Prime 组件发送命令并检查事件。”
每周 5 个新技能,1 分钟读完。
工作原理
AI 会在组件文件夹中设置测试文件,使用地面系统测试 API 发送命令并读取事件和遥测,然后运行测试。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Skill: F Prime Reusable Component Integration Testing
Reusable integration tests live in the component's own
test/int/ folder and verify that the component works correctly
in a running deployment. They exercise the component through the
Ground Data System (GDS) — sending commands, checking events, and
reading telemetry over the actual communication stack.
For the full implementation guide, see Reusable Integration Tests. For the complete API reference (send commands, assert events/telemetry, predicates, histories), see the GDS Integration Test API Guide.
Note: This skill covers component-level reusable integration tests. System-wide integration tests (testing cross-component workflows across an entire deployment) are a separate concern.
Prerequisites
The component must be added to a topology before integration tests
can run. If it has not been integrated yet, see
docs/user-manual/overview/development-practice.md § "Assemble
Topology".
The deployment must be running (via fprime-gds) for integration
tests to execute.
Process
Step 1 — Set Up Test Directory
Create test/int/test_<ComponentName>.py in the component folder.
See
Reusable Integration Tests
for the expected file layout and int_config.json configuration.
Step 2 — Write Reusable Tests
Tests use pytest with the fprime_test_api fixture. Use
fprime_test_api.get_mnemonic() to resolve instance names from a
configuration file, making tests portable across deployments. See the
GDS Test API Guide
for the full API (sending commands, asserting events/telemetry,
predicates, sequences).
Key patterns:
send_and_assert_command()— send + verify command success eventsassert_event()/assert_telemetry()— verify component outputget_mnemonic()— resolve qualified names for portability- Map each test to a requirement in the docstring (
Covers: REQ-*)
Step 3 — Draft Requirements Coverage
Draft which requirements should be covered by integration tests. Aim for reasonable coverage of the component's requirements, especially those that exercise inter-component behavior.
Step 4 — Run Integration Tests
# Start the deployment + GDS (in separate terminal)
fprime-gds --dictionary <path-to-dictionary>
# Run the component's reusable tests against a deployment
pytest <Component>/test/int/ \
--dictionary <path-to-dictionary> \
--deployment-config <path>/int_config.json
See Reusable Integration Tests § Running the tests
for CI integration using fprime-actions/run-integration-tests.
Anti-Patterns
- Hardcoding instance mnemonics — use
get_mnemonic()for portability - Writing tests that depend on test execution order
- Ignoring
max_delay/timeout(tests will hang or be flaky) - Not mapping tests to requirements
- Testing unit-level behavior in integration tests (use unit tests for that)
常见问题
测试需要系统处于运行状态吗?
需要。在执行测试之前,部署必须已通过地面数据系统运行起来。
这些测试涵盖整个系统的工作流程吗?
不涵盖。它们只针对一个组件,系统级测试是另一个主题。
测试文件放在哪里?
它们位于组件自己的 test/int 文件夹中,因此任何包含该组件的部署都可以运行它们。
详情
作者的原始描述
Integration testing phase of F Prime component development. Guides the agent through writing reusable pytest-based integration tests in the component's test/int/ folder using the GDS Integration Test API. These tests ship with the component and can be run against any deployment that includes it. Trigger when unit tests pass and the component is ready for integration testing. Keywords: F Prime, integration test, pytest, GDS, fprime_test_api, reusable test, component test.
repo: nasa/fprime
热度
- GitHub 星标
- 12k
- 排名
- #11497
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
fprime-cmake-build-system
12k帮你的智能体通过 F Prime 项目的 CMake 层,为飞行软件项目添加模块、构建目标和平台设置。
fprime-component-design-fpp
12k帮你的智能体把已批准的 F Prime 组件需求,转化为一个描述其端口、命令、事件和遥测的 FPP 模型。
fprime-component-development
12k帮你的智能体引导 F Prime 组件经历每个开发阶段,从需求一直到集成测试。
fprime-component-implementation
12k帮你的智能体按照项目规则,编写 F Prime 组件自动生成的处理函数背后的 C++ 代码。