Test-driven Development
テスト駆動開発
テスト駆動開発(TDD)は三つのステップを繰り返します。小さな失敗するテストを書く。合格する最小限のコードを書く。それからコードの動作を変えずにコードを整理する。
もう一つの例
開発者は、失敗する例のテスト1つで新しい金額丸めルールを開始します。最も小さいコードでそれを通過させ、その後、繰り返されたコードをすべてのテストがグリーンのままクリーンアップします。コードの後で書かれたテストは役に立ちますが、それはTDDのテストファーストサイクルではありません。
主な部分
- 01失敗例
- 02最小合格コード
- 03安全なリファクタリング
以下の場合に使用します
次の設計ステップが失敗したテストに導かれ、安全なクリーンアップに続く場合、この用語を使用します。
以下の場合は使用しないでください
多くのテストがあるからといって、プロジェクトをTDDと呼んではいけません。コードはテストファーストのループに従う必要があります。
コードで使用する名前
red → green → refactor 出荷前に
Check the environment and prepared test data (fixture). Define a result you can observe, failure and edge cases, isolation, stable inputs, useful error details, and cleanup. Set a time budget, owner, and flaky-test rule.
Outcome:Complete the task with テスト駆動開発 (Test-driven Development)。 User context:開発者は、失敗する例のテスト1つで新しい金額丸めルールを開始します。最も小さいコードでそれを通過させ、その後、繰り返されたコードをすべてのテストがグリーンのままクリーンアップします。コードの後で書かれたテストは役に立ちますが、それはTDDのテストファーストサイクルではありません。 Validation approach:テスト駆動開発 (Test-driven Development)。 Why it fits:次の設計ステップが失敗したテストに導かれ、安全なクリーンアップに続く場合、この用語を使用します。 Do not use it when:多くのテストがあるからといって、プロジェクトをTDDと呼んではいけません。コードはテストファーストのループに従う必要があります。 Test requirements: Name the system and test environment. Define prepared test data, other inputs, and the result you can observe. Include failure and edge cases, allowed error, isolation, and cleanup. Test operations: Make failures easy to diagnose. Control random or changing inputs. Name an owner. Keep the test fast and simple enough for its release gate. Acceptance criteria: The test fails for the known bug and passes after the fix. It repeats in the target environment, gives useful evidence, and does not expose or change unrelated data. Evidence and limits (evidence boundary):単一の公式標準が全体の用語を管理するわけではありません。その意味はチーム、プラットフォーム、またはフレームワークによって変わる可能性があります。 Unknowns to confirm: Release gate, environment, prepared test data, allowed error, time budget, owner, and flaky-test rule.
このリクエストを確認する
Review how テスト駆動開発 (Test-driven Development) is used now. Definition: テスト駆動開発(TDD)は三つのステップを繰り返します。小さな失敗するテストを書く。合格する最小限のコードを書く。それからコードの動作を変えずにコードを整理する。 Release checks: Check the environment and prepared test data (fixture). Define a result you can observe, failure and edge cases, isolation, stable inputs, useful error details, and cleanup. Set a time budget, owner, and flaky-test rule. Before changing code, list the evidence, gaps, severity, and the smallest safe fix.