Skip to content
cccskills
FreePublished on GitHub

testing

Testing strategies and methodologies including TDD and E2E testing. Use when writing tests, implementing TDD workflow, or setting up E2E test infrastructure.

The English summary is being prepared. Showing the original description.

Works withPlaywright
See how to install

Files included (6)

  • SKILL.md3.1 KB
  • e2e.md5.9 KB
  • frameworks.md5.5 KB
  • qa-methodology.md10.0 KB
  • tdd-example.md8.8 KB
  • tdd.md7.8 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

测试策略

关联 Agent: tdd-guide(测试驱动开发)、code-reviewer(可测试性评估)、build-error-resolver(修复后测试验证)

本技能提供测试策略选择指南,整合 TDD(测试驱动开发)和 E2E(端到端测试)最佳实践。

子文件

测试金字塔

        ┌─────────┐
        │  E2E   │  少量:验证核心流程
        ├─────────┤
        │集成测试 │  中等:验证组件交互
        ├─────────┤
        │单元测试 │  大量:验证独立单元
        └─────────┘

测试策略选择

场景推荐策略参阅文件
新功能开发TDD(测试先行)tdd.md
Bug 修复先写失败测试,再修复tdd.md
核心用户流程验证E2E 测试e2e.md
重构现有代码先补测试,再重构tdd.md
UI 交互验证E2E + 视觉回归e2e.md

覆盖率目标

代码类型单元测试E2E 测试
核心业务逻辑100%关键流程
普通业务代码80%+可选
工具函数80%+不需要
UI 组件70%+关键交互

最佳实践

  1. 测试先行 - TDD 循环:RED → GREEN → REFACTOR
  2. 独立隔离 - 每个测试独立运行,无共享状态
  3. 快速反馈 - 单元测试 < 50ms,E2E 适度控制
  4. 语义命名 - 测试名称描述行为,不描述实现
  5. 分层覆盖 - 单元测试多,E2E 测试精

TDD 循环速览

RED → GREEN → REFACTOR → REPEAT

RED:      写一个失败的测试
GREEN:    写最少的代码使测试通过
REFACTOR: 改进代码,保持测试绿色
REPEAT:   下一个场景

详细指南参阅 tdd.md

E2E 测试速览

tests/
├── e2e/                       # E2E 测试目录
│   ├── auth/                  # 认证流程
│   └── core/                  # 核心功能
├── pages/                     # Page Object Model
└── playwright.config.ts

详细指南参阅 e2e.md

测试命令

# 单元测试
npm test
npm test -- --coverage

# E2E 测试
npx playwright test
npx playwright test --headed  # 可视化
npx playwright test --debug   # 调试模式

记住:测试不是可选项。它是支持自信重构、快速开发和生产可靠性的安全网。

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

api

Free

RESTful API design patterns and best practices. Use when creating endpoints, designing APIs, or implementing routes.

The English summary is being prepared. Showing the original description.

xiaobei930/cc-best48Updated Jun 13, 2026

Architecture design skill: ADR records, system design checklists, scalability assessment, architecture patterns. Use for complex system design and architecture decisions.

The English summary is being prepared. Showing the original description.

xiaobei930/cc-best48Updated Jun 13, 2026

Backend development patterns for services, error handling, logging, caching. Use when building backend services, APIs, or microservices.

The English summary is being prepared. Showing the original description.

xiaobei930/cc-best48Updated Jun 13, 2026

Strategic compaction skill: suggests context compression at logical breakpoints. Use to suggest compaction at logical intervals during development sessions.

The English summary is being prepared. Showing the original description.

xiaobei930/cc-best48Updated Jun 13, 2026

Database design, query optimization, migrations, and indexing. Use when designing schemas, writing queries, or managing migrations.

The English summary is being prepared. Showing the original description.

xiaobei930/cc-best48Updated Jun 13, 2026

debug

Free

Systematic debugging methods, log analysis, and performance diagnostics. Use when debugging issues, analyzing errors, or troubleshooting incidents.

The English summary is being prepared. Showing the original description.

xiaobei930/cc-best48Updated Jun 13, 2026

See all skills by xiaobei930

Report a problem with this skill