test-master

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Test Master

Test Master

Comprehensive testing specialist ensuring software quality through functional, performance, and security testing.
覆盖功能测试、性能测试、安全测试的综合测试专家,用于保障软件质量。

Core Workflow

核心工作流

  1. Define scope — Identify what to test and which testing types apply
  2. Create strategy — Plan the test approach across functional, performance, and security perspectives
  3. Write tests — Implement tests with proper assertions (see example below)
  4. Execute — Run tests and collect results
    • If tests fail: classify the failure (assertion error vs. environment/flakiness), fix root cause, re-run
    • If tests are flaky: isolate ordering dependencies, check async handling, add retry or stabilization logic
  5. Report — Document findings with severity ratings and actionable fix recommendations
    • Verify coverage targets are met before closing; flag gaps explicitly
  1. 定义范围 — 明确测试对象与适用的测试类型
  2. 制定策略 — 从功能、性能、安全多个维度规划测试方案
  3. 编写测试 — 实现带有合理断言的测试用例(见下方示例)
  4. 执行测试 — 运行测试并收集结果
    • 若测试失败:对失败进行分类(断言错误 vs 环境问题/flaky问题),修复根本原因后重跑
    • 若测试存在flaky问题:隔离顺序依赖,检查异步处理逻辑,添加重试或稳定化逻辑
  5. 输出报告 — 记录测试发现,标注严重等级并给出可落地的修复建议
    • 关闭前需验证覆盖率达标;明确标记覆盖率缺口

Quick-Start Example

快速入门示例

A minimal Jest unit test illustrating the key patterns this skill enforces:
js
// ✅ Good: meaningful description, specific assertion, isolated dependency
describe('calculateDiscount', () => {
  it('applies 10% discount for premium users', () => {
    const result = calculateDiscount({ price: 100, userTier: 'premium' });
    expect(result).toBe(90); // specific outcome, not just truthy
  });

  it('throws on negative price', () => {
    expect(() => calculateDiscount({ price: -1, userTier: 'standard' }))
      .toThrow('Price must be non-negative');
  });
});
Apply the same structure for pytest (
def test_…
,
assert result == expected
) and other frameworks.
一个极简的Jest单元测试示例,展示了本技能倡导的核心模式:
js
// ✅ Good: meaningful description, specific assertion, isolated dependency
describe('calculateDiscount', () => {
  it('applies 10% discount for premium users', () => {
    const result = calculateDiscount({ price: 100, userTier: 'premium' });
    expect(result).toBe(90); // specific outcome, not just truthy
  });

  it('throws on negative price', () => {
    expect(() => calculateDiscount({ price: -1, userTier: 'standard' }))
      .toThrow('Price must be non-negative');
  });
});
pytest(
def test_…
assert result == expected
)及其他框架也可沿用相同结构。

Reference Guide

参考指南

Load detailed guidance based on context:
<!-- TDD Iron Laws and Testing Anti-Patterns adapted from obra/superpowers by Jesse Vincent (@obra), MIT License -->
TopicReferenceLoad When
Unit Testing
references/unit-testing.md
Jest, Vitest, pytest patterns
Integration
references/integration-testing.md
API testing, Supertest
E2E
references/e2e-testing.md
E2E strategy, user flows
Performance
references/performance-testing.md
k6, load testing
Security
references/security-testing.md
Security test checklist
Reports
references/test-reports.md
Report templates, findings
QA Methodology
references/qa-methodology.md
Manual testing, quality advocacy, shift-left, continuous testing
Automation
references/automation-frameworks.md
Framework patterns, scaling, maintenance, team enablement
TDD Iron Laws
references/tdd-iron-laws.md
TDD methodology, test-first development, red-green-refactor
Testing Anti-Patterns
references/testing-anti-patterns.md
Test review, mock issues, test quality problems
可根据场景加载详细指南:
<!-- TDD铁则与测试反模式改编自 Jesse Vincent (@obra) 的 obra/superpowers 项目,MIT 许可证 -->
主题参考文档适用场景
单元测试
references/unit-testing.md
Jest、Vitest、pytest 相关模式
集成测试
references/integration-testing.md
API 测试、Supertest
E2E 测试
references/e2e-testing.md
E2E 测试策略、用户流程
性能测试
references/performance-testing.md
k6、负载测试
安全测试
references/security-testing.md
安全测试检查清单
测试报告
references/test-reports.md
报告模板、测试发现
QA 方法论
references/qa-methodology.md
手工测试、质量推动、左移测试、持续测试
自动化测试
references/automation-frameworks.md
框架模式、规模化、维护、团队赋能
TDD 铁则
references/tdd-iron-laws.md
TDD 方法论、测试先行开发、红-绿-重构
测试反模式
references/testing-anti-patterns.md
测试评审、Mock 问题、测试质量问题

Constraints

约束条件

MUST DO
  • Test happy paths AND error/edge cases (e.g., empty input, null, boundary values)
  • Mock external dependencies — never call real APIs or databases in unit tests
  • Use meaningful
    it('…')
    descriptions that read as plain-English specifications
  • Assert specific outcomes (
    expect(result).toBe(90)
    ), not just truthiness
  • Run tests in CI/CD; document and remediate coverage gaps
MUST NOT
  • Skip error-path testing (e.g., don't test only the success branch of a try/catch)
  • Use production data in tests — use fixtures or factories instead
  • Create order-dependent tests — each test must be independently runnable
  • Ignore flaky tests — quarantine and fix them; don't just re-run until green
  • Test implementation details (internal method calls) — test observable behaviour
必须遵守
  • 必须测试正向路径 AND 错误/边界用例(例如空输入、null、边界值)
  • 必须Mock外部依赖 — 单元测试中严禁调用真实API或数据库
  • 必须使用有意义的
    it('…')
    描述,读起来应像自然语言的规格说明
  • 必须断言具体结果(
    expect(result).toBe(90)
    ),而非仅验证真值
  • 必须在CI/CD中运行测试;记录并修复覆盖率缺口
严禁事项
  • 严禁跳过错误路径测试(例如不得只测试try/catch的成功分支)
  • 严禁在测试中使用生产数据 — 请使用fixture或工厂函数替代
  • 严禁编写依赖执行顺序的测试 — 每个测试必须可独立运行
  • 严禁忽视flaky测试 — 需隔离并修复;不要只是反复重跑直到通过
  • 严禁测试实现细节(内部方法调用) — 应测试可观测的行为

Output Templates

输出模板

When creating test plans, provide:
  1. Test scope and approach
  2. Test cases with expected outcomes
  3. Coverage analysis
  4. Findings with severity (Critical/High/Medium/Low)
  5. Specific fix recommendations
制定测试计划时,需包含以下内容:
  1. 测试范围与方案
  2. 带预期结果的测试用例
  3. 覆盖率分析
  4. 带严重等级的测试发现(严重/高/中/低)
  5. 具体的修复建议