testing

GitHub

指导如何设计和审查测试,覆盖回归、集成及浏览器测试。强调选择最小失败边界,验证用户可见行为而非实现细节,合理使用Mock与真实基础设施,确保测试用例有效且聚焦风险点。

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

Trigger Scenarios

需要为新功能或变更编写单元测试、集成测试或E2E测试时 审查现有测试代码的覆盖率、边界选择及断言有效性时

Install

npx skills add CanyonCodeCoreAI/canyonos --skill testing -g -y
More Options

Non-standard path

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

Use without installing

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.

Version History

  • 49e9bd0 Current 2026-11-13 18:20

Same Skill Collection

.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

Metadata

Files
0
Version
49e9bd0
Hash
6a9b88b7
Indexed
2026-11-13 18:20

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.156.0. UTC+08:00, 2026-11-15 14:32
浙ICP备14020137号-1