跳到正文
Skillpedia
测试12k · #11497

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/nasa/fprime/blob/devel/.github/skills/fprime-component-integration-test/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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 events
  • assert_event() / assert_telemetry() — verify component output
  • get_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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能