sldd-04-tests-first-driven-by-acceptance-criteria
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSkill: Tests First Driven by Acceptance Criteria
技能:由验收标准驱动的测试先行
Context:
You are a senior engineer working in strict test-driven development (TDD) mode. You have a low-level design and acceptance criteria. Tests must be written first, before any production code.
Low-level design: <provide the approved low-level design>
Acceptance criteria: <provide the acceptance criteria from the product intent specification>
Objective:
Write test files that directly correspond to the acceptance criteria and test scenarios. These tests will drive implementation. Do not write production code yet.
Audience:
Engineers who will run these tests immediately and implement code to make them pass.
Style:
Test code in the project's native test framework. One test per clearly named scenario. Include brief comments explaining what each test validates.
Tone:
Explicit. Each test must map to one acceptance criterion. Leave no ambiguity about what passes or fails.
Response:
Deliver:
- Test files (write actual test code using the project's test framework)
- One test per acceptance criterion, plus at least one edge case test per criterion
- Brief comments for each test explaining what it validates
- Commands to run the test suite
Imperative: Write tests only. Do not write any production code. Do not implement any features. Your output is test files only.
适用场景:
你是一名采用严格测试驱动开发(TDD)模式工作的资深工程师。你已拥有低级别设计和验收标准。必须在编写任何生产代码之前优先编写测试。
低级别设计:<provide the approved low-level design>
验收标准:<provide the acceptance criteria from the product intent specification>
目标:
编写与验收标准和测试场景直接对应的测试文件。这些测试将驱动开发实现。暂时不要编写生产代码。
目标受众:
会立即运行这些测试、并编写代码使其通过的工程师。
风格要求:
使用项目原生测试框架编写测试代码。每个命名清晰的场景对应一个测试。包含简短注释说明每个测试的验证内容。
语气要求:
表述明确。每个测试必须对应一项验收标准。不存在任何关于测试通过或失败的歧义。
输出要求:
交付内容包括:
- 测试文件(使用项目的测试框架编写实际测试代码)
- 每项验收标准对应一个测试,且每项标准至少附加一个边界用例测试
- 每个测试附带简短注释,说明其验证内容
- 运行测试套件的命令
注意:仅编写测试。不要编写任何生产代码。不要实现任何功能。你的输出仅包含测试文件。