testing
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTesting Skill
测试Skill
Comprehensive testing domain for pytest-based projects. Provides test generation, review, execution, and specialized testing workflows with automatic routing based on user intent.
这是针对基于pytest的项目的综合性测试领域,提供测试生成、评审、执行功能,以及可根据用户意图自动路由的专属测试工作流。
Auto-Activation Keywords
自动激活关键词
This skill activates automatically when you mention:
- test, tests, testing
- coverage, test coverage
- pytest, unittest
- integration test, unit test, e2e test
- performance test, benchmark, load test
- security test, penetration test
- test review, test quality
当你提及以下内容时,该Skill会自动激活:
- test、tests、testing
- coverage、测试覆盖率
- pytest、unittest
- integration test(集成测试)、unit test(单元测试)、e2e test(端到端测试)
- performance test(性能测试)、benchmark(基准测试)、load test(负载测试)
- security test(安全测试)、penetration test(渗透测试)
- test review(测试评审)、test quality(测试质量)
Routing Logic
路由逻辑
Based on user intent, this skill routes to appropriate workflows:
根据用户意图,该Skill会路由至对应的工作流:
Test Generation
测试生成
Keywords: "generate tests", "create tests", "write tests", "test coverage"
- Simple test generation → Use workflow
/testing/generate - Complex test strategy → Invoke agent
test-engineer
关键词:"generate tests"(生成测试)、"create tests"(创建测试)、"write tests"(编写测试)、"test coverage"(测试覆盖率)
- 简单测试生成 → 使用工作流
/testing/generate - 复杂测试策略 → 调用agent
test-engineer
Test Review
测试评审
Keywords: "review tests", "test quality", "coverage gaps", "improve tests"
- Review existing tests → Use workflow
/testing/review - Comprehensive quality audit → Invoke agent
test-engineer
关键词:"review tests"(评审测试)、"test quality"(测试质量)、"coverage gaps"(覆盖率缺口)、"improve tests"(优化测试)
- 评审现有测试 → 使用工作流
/testing/review - 全面质量审计 → 调用agent
test-engineer
End-to-End Testing
端到端测试
Keywords: "e2e test", "end-to-end", "full workflow", "integration test", "pipeline test"
- E2E test generation → Use workflow
/testing/e2e - Complex multi-component → Invoke agent
test-engineer
关键词:"e2e test"(端到端测试)、"end-to-end"(端到端)、"full workflow"(完整工作流)、"integration test"(集成测试)、"pipeline test"(流水线测试)
- E2E测试生成 → 使用工作流
/testing/e2e - 复杂多组件测试 → 调用agent
test-engineer
Performance Testing
性能测试
Keywords: "performance test", "benchmark", "load test", "memory usage", "speed test"
- Performance test creation → Use workflow
/testing/performance - Comprehensive performance analysis → Invoke agent
test-engineer
关键词:"performance test"(性能测试)、"benchmark"(基准测试)、"load test"(负载测试)、"memory usage"(内存占用)、"speed test"(速度测试)
- 性能测试创建 → 使用工作流
/testing/performance - 全面性能分析 → 调用agent
test-engineer
Security Testing
安全测试
Keywords: "security test", "vulnerability", "penetration test", "OWASP", "injection"
- Security test generation → Use workflow
/testing/security - Full security audit → Invoke agent
security-auditor
关键词:"security test"(安全测试)、"vulnerability"(漏洞)、"penetration test"(渗透测试)、"OWASP"、"injection"(注入)
- 安全测试生成 → 使用工作流
/testing/security - 全面安全审计 → 调用agent
security-auditor
Test Execution
测试执行
Keywords: "run tests", "execute tests", "test results", "pytest command"
- Quick reference → See context/pytest-commands.md
- Custom test execution → Use bash with pytest commands
关键词:"run tests"(运行测试)、"execute tests"(执行测试)、"test results"(测试结果)、"pytest command"(pytest命令)
- 快速参考 → 查看context/pytest-commands.md
- 自定义测试执行 → 使用bash执行pytest命令
Workflow Quick Reference
工作流快速参考
bash
undefinedbash
undefinedGenerate comprehensive tests
Generate comprehensive tests
/testing/generate [module-path]
/testing/generate [module-path]
Review test quality
Review test quality
/testing/review [test-directory]
/testing/review [test-directory]
Create E2E tests
Create E2E tests
/testing/e2e [workflow-name]
/testing/e2e [workflow-name]
Create performance tests
Create performance tests
/testing/performance [component]
/testing/performance [component]
Create security tests
Create security tests
/testing/security [attack-vector]
undefined/testing/security [attack-vector]
undefinedComplex Task Delegation
复杂任务委托
For complex multi-step testing tasks, invoke the agent via Task tool:
test-engineerUse test-engineer agent when:
- Designing comprehensive test strategy across multiple components
- Creating complete test suites from scratch (unit + integration + e2e)
- Optimizing test performance and coverage simultaneously
- Integrating multiple testing types (functional + performance + security)对于复杂的多步骤测试任务,可通过Task工具调用 agent:
test-engineerUse test-engineer agent when:
- Designing comprehensive test strategy across multiple components
- Creating complete test suites from scratch (unit + integration + e2e)
- Optimizing test performance and coverage simultaneously
- Integrating multiple testing types (functional + performance + security)Supporting Context
支持上下文
- Pytest patterns: See for common test patterns
context/pytest-patterns.md - Common commands: See for frequently used commands
context/pytest-commands.md - Coverage standards: Minimum 80% coverage required (see )
/standards/python.md
- Pytest patterns:查看获取常见测试模式
context/pytest-patterns.md - Common commands:查看获取常用命令
context/pytest-commands.md - Coverage standards:要求最低80%的测试覆盖率(详见)
/standards/python.md
Integration Points
集成点
Agents
Agents
- test-engineer: Comprehensive test strategy and generation
- security-auditor: Security-focused testing and vulnerability analysis
- test-engineer:提供全面的测试策略与生成服务
- security-auditor:专注于安全测试与漏洞分析
MCP Tools
MCP Tools
- mcp__zen-core__chat: Multi-model consensus for complex test design decisions
- mcp__zen-core__chat:为复杂测试设计决策提供多模型共识支持
Hooks
Hooks
- TDD enforcement: Pre-Write/Edit hook enforces test-first development
- TDD enforcement:Pre-Write/Edit钩子可强制执行测试先行的开发模式
Standards
Standards
- Python testing standards: (80%+ coverage requirement)
/standards/python.md - Linting standards: (pytest configuration)
/standards/linting.md
- Python测试标准:(要求80%以上的测试覆盖率)
/standards/python.md - 代码检查标准:(pytest配置相关)
/standards/linting.md
Testing Standards Summary
测试标准汇总
Required for all projects:
- Minimum 80% test coverage
- Unit tests in (< 1s each)
tests/unit/ - Integration tests in (< 5s each)
tests/integration/ - E2E tests in (marked @pytest.mark.e2e)
tests/e2e/ - Proper pytest markers (@pytest.mark.unit, .integration, .slow, .security, .perf)
- AAA pattern (Arrange-Act-Assert)
- Clear test naming (test_should_[expected]when[condition])
Fixture management:
- Use existing fixtures from conftest.py
- No hardcoded test data
- Appropriate fixture scope (function, class, module, session)
Test execution:
bash
undefined所有项目必须满足:
- 最低80%的测试覆盖率
- 单元测试存放于目录(每个测试耗时<1秒)
tests/unit/ - 集成测试存放于目录(每个测试耗时<5秒)
tests/integration/ - 端到端测试存放于目录(标记为@pytest.mark.e2e)
tests/e2e/ - 使用正确的pytest标记(@pytest.mark.unit、.integration、.slow、.security、.perf)
- 遵循AAA模式(准备-执行-断言)
- 清晰的测试命名规范(test_should_[预期结果]when[条件])
Fixture管理:
- 使用conftest.py中的现有fixture
- 禁止使用硬编码测试数据
- 选择合适的fixture作用域(function、class、module、session)
测试执行:
bash
undefinedStandard test run with coverage
Standard test run with coverage
poetry run pytest -v --cov=src --cov-report=html --cov-report=term-missing --cov-fail-under=80
poetry run pytest -v --cov=src --cov-report=html --cov-report=term-missing --cov-fail-under=80
Fast dev cycle (skip slow tests)
Fast dev cycle (skip slow tests)
poetry run pytest -m "not slow"
poetry run pytest -m "not slow"
Specific test categories
Specific test categories
poetry run pytest tests/unit/ # Unit tests only
poetry run pytest tests/integration/ # Integration tests
poetry run pytest -m security # Security tests
poetry run pytest -m perf # Performance tests
undefinedpoetry run pytest tests/unit/ # Unit tests only
poetry run pytest tests/integration/ # Integration tests
poetry run pytest -m security # Security tests
poetry run pytest -m perf # Performance tests
undefinedExamples
示例
Example 1: Generate tests for new module
User: "Generate comprehensive tests for the payment processor module"
→ Skill routes to /testing/generate workflow
→ Workflow creates unit, integration, and security tests
→ Ensures 80%+ coverage for payment processorExample 2: Review test quality
User: "Review the tests for the authentication system and suggest improvements"
→ Skill routes to /testing/review workflow
→ Workflow analyzes coverage, patterns, fixture usage
→ Provides actionable recommendationsExample 3: Complex test strategy
User: "Design a comprehensive testing strategy for the new RAG pipeline"
→ Skill invokes test-engineer agent
→ Agent creates multi-tier testing approach:
- Unit tests for embeddings, chunking, retrieval
- Integration tests for pipeline flows
- E2E tests for complete query-response cycles
- Performance tests for large document handlingThis skill consolidates test-generator, test-reviewer, e2e-tester, performance-tester, and security-tester into a unified testing domain with intelligent routing.
示例1:为新模块生成测试
用户:"为支付处理器模块生成全面的测试用例"
→ Skill路由至/testing/generate工作流
→ 工作流创建单元、集成与安全测试
→ 确保支付处理器模块的测试覆盖率达到80%以上示例2:评审测试质量
用户:"评审认证系统的测试用例并提出改进建议"
→ Skill路由至/testing/review工作流
→ 工作流分析覆盖率、测试模式、fixture使用情况
→ 提供可执行的改进建议示例3:复杂测试策略设计
用户:"为新的RAG流水线设计全面的测试策略"
→ Skill调用test-engineer agent
→ Agent创建多层级测试方案:
- 针对嵌入、分块、检索功能的单元测试
- 针对流水线流程的集成测试
- 针对完整查询-响应周期的端到端测试
- 针对大文档处理的性能测试该Skill整合了test-generator、test-reviewer、e2e-tester、performance-tester和security-tester,形成一个具备智能路由功能的统一测试领域。