testing

GitHub

指导如何设计或审查测试,确保覆盖变更行为。包括选择测试边界(集成、单元、浏览器)、验证行为而非实现细节、合理模拟依赖,以及保持测试套件的有效性和可维护性。

.agents/skills/testing/SKILL.md CanyonCodeCoreAI/canyonos

触发场景

需要为变更功能编写回归测试 审查现有测试用例的覆盖率和有效性 确定集成测试或单元测试的最佳实践

安装

npx skills add CanyonCodeCoreAI/canyonos --skill testing -g -y
更多选项

非标准路径

npx skills add https://github.com/CanyonCodeCoreAI/canyonos/tree/main/.agents/skills/testing -g -y

不安装直接使用

npx skills use CanyonCodeCoreAI/canyonos@testing

指定 Agent (Claude Code)

npx skills add CanyonCodeCoreAI/canyonos --skill testing -a claude-code -g -y

安装 repo 全部 skill

npx skills add CanyonCodeCoreAI/canyonos --all -g -y

预览 repo 内 skill

npx skills add CanyonCodeCoreAI/canyonos --list

SKILL.md

Frontmatter
{
    "name": "testing",
    "description": "Design or review focused tests for changed behavior. Use for regression coverage, test boundaries, integration tests, browser tests, fixtures, and deciding whether a test is warranted."
}

Testing

Prove the changed behavior at the smallest boundary that can fail in the way a user or caller would notice. Follow repository-required coverage for changed features and contracts. Beyond that, add a test for a user-reported bug, a likely regression in complex behavior, or an explicit request—not merely to grow coverage.

Choose the boundary

  1. Start with the public behavior: command, endpoint, UI flow, or durable integration point.
  2. Prefer a focused integration test when collaboration between modules is the risk. Use a narrow unit test for a difficult invariant or edge case that does not need the full boundary.
  3. Use a browser test for behavior that depends on real browser semantics, accessibility, layout, or integration—not merely to prove a function call.

Reuse the repository's test stack and fixtures. Do not migrate tooling or invent a general framework to add one case.

Test behavior, not the implementation

  • Render real UI and drive accessible user interactions; assert observable output, not internal state, implementation classes, or hook calls.
  • Mock external boundaries only when the real dependency is unavailable, expensive, nondeterministic, or unsafe. Do not mock the module whose behavior the test is meant to prove.
  • Use disposable real infrastructure when persistence, transactions, queries, or lifecycle behavior matters. Keep fixtures explicit about setup and cleanup.
  • Make asynchronous tests wait on the condition that matters. Bound timeouts and retain enough output to diagnose failures.

Keep the suite useful

Each test should fail for the behavior it names. Include the unhappy path when it is part of the changed contract, but do not duplicate nearby cases without a new risk. Run the narrow test first, then repository-required checks, and report what was not exercised.

版本历史

  • 49e9bd0 当前 2026-11-13 18:20

同 Skill 集合

.agents/skills/api-dev/SKILL.md
.agents/skills/architecture/SKILL.md
.agents/skills/cc-pr-review/SKILL.md
.agents/skills/code-review/SKILL.md
.agents/skills/diagnosing-bugs/SKILL.md
.agents/skills/python-systems/SKILL.md
.agents/skills/ui-dev/SKILL.md
skills/converting-to-canyonos/SKILL.md
skills/prompt-management/SKILL.md
skills/scaling-agents/SKILL.md

元信息

文件数
0
版本
49e9bd0
Hash
6a9b88b7
收录时间
2026-11-13 18:20

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.156.0. UTC+08:00, 2026-11-14 02:24
浙ICP备14020137号-1