tdd-workflow
Use this skill when writing new features, fixing bugs, or refactoring code. Enforces test-driven development, ensuring unit, integration, and end-to-end test coverage exceeds 80%.
Machine translationRead the original Chinese text
在编写新功能、修复错误或重构代码时使用此技能。强制执行测试驱动开发,确保单元测试、集成测试和端到端测试的覆盖率超过80%。
Target: Software development & testing. Automatically collected · unverified.
Excerpt from the author’s documentation
Extracted from a fixed version of SKILL.md in its original language. This is the author’s documentation; installation, compatibility and runtime results have not been verified by this site.
Read the original Chinese text
Topics in the source
- 测试驱动开发工作流
- 何时激活
- 核心原则
- 1. 测试优先于代码
- 2. 覆盖率要求
- 3. 测试类型
- 单元测试
- 集成测试
此技能确保所有代码开发遵循TDD原则,并具备全面的测试覆盖率。 编写新功能或功能 修复错误或问题 重构现有代码 添加API端点 创建新组件 始终先编写测试,然后实现代码以使测试通过。 最低80%覆盖率(单元 + 集成 + 端到端) 覆盖所有边缘情况 测试错误场景 验证边界条件 单个函数和工具 组件逻辑 纯函数 辅助函数和工具 API端点 数据库操作 服务交互 外部API调用 关键用户流程 完整工作流 浏览器自动化 UI交互 针对每个用户旅程,创建全面的测试用例: 编写最少的代码以使测试通过: 在保持测试通过的同时提高代码质量: 消除重复 改进命名 优化性能 增强可读性 1. 先写测试 - 始终遵循TDD 2. 每个测试一个断言 - 专注于单一行为 3. 描述性的测试名称 - 解释测试内容 4. 组织-执行-断言 - 清晰的测试结构 5. 模拟外部依赖 - 隔离单元测试 6. 测试边缘情况 - Null、undefined、空、大量数据 7. 测试错误路径 - 不仅仅是正常路径 8. 保持测试快速 - 单元测试每个 < 50ms 9. 测试后清理 - 无副作用 10. 审查覆盖率报告 - 识别空白 达到 80%+ 代码覆盖率 所有测试通过(绿色) 没有跳过或禁用的测试 快速测试执行(单元测试 < 30秒) 端到端测试覆盖关键用户流程 测试在生产前捕获错误 记住:测试不是可选的。它们是安全网,能够实现自信的重构、快速的开发和生产的可靠性。
- Source repository
- affaan-m/ECC
- Source file
- docs/zh-CN/skills/tdd-workflow/SKILL.md
- Fixed revision
- d2ef2680594f9a17526a6e1a2e18b3d242c5d17b
Sources and evidence
This record was collected automatically. Its documentation, suitability and runtime behavior have not been manually verified.
Author: affaan-m/ECC · original repository metadata. Documentation review: Not reviewed. Last source check: 2026-11-09T15:01:42.671Z.
Categories are inferred from names, descriptions and paths. They do not establish compatibility.
License and attribution
MIT. Third-party content and copyright remain with their authors. Refer to the original license and terms.
Original license ↗Synchronization, copying and user-reported success do not mark a resource as runtime-tested.
Limitations and notes
- Collecting metadata does not mean this site has installed, adapted, runtime-tested or security-reviewed the resource.