Contract Testing
契約試験
契約テストは、別々に展開できる2つのシステムが合意された形式でメッセージを交換しているかどうかを確認します。
もう一つの例
クライアントは GET /profiles/42 が特定のフィールドとステータスを返すことを期待します。継続的インテグレーション(CI)は、プロバイダーがこの約束を守っているかを確認します。このテストは、全体のプロセスやライブデータの品質を証明するものではありません。
主な部分
- 01コンシューマー契約
- 02プロバイダー確認
- 03互換性の結果
以下の場合に使用します
サービスが独自にデプロイされ、システム全体を使わずにメッセージの互換性を確認する必要がある場合に、この用語を使用します。
以下の場合は使用しないでください
プロバイダーのプライベートコードを契約にコピーしたり、このテストをAPIセキュリティテストの代わりに使用したりしないでください。
コードで使用する名前
consumer expectation ↔ provider verification 出荷前に
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 契約試験 (Contract Testing)。 User context:クライアントは GET /profiles/42 が特定のフィールドとステータスを返すことを期待します。継続的インテグレーション(CI)は、プロバイダーがこの約束を守っているかを確認します。このテストは、全体のプロセスやライブデータの品質を証明するものではありません。 Validation approach:契約試験 (Contract Testing)。 Why it fits:サービスが独自にデプロイされ、システム全体を使わずにメッセージの互換性を確認する必要がある場合に、この用語を使用します。 Do not use it when:プロバイダーのプライベートコードを契約にコピーしたり、このテストをAPIセキュリティテストの代わりに使用したりしないでください。 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 契約試験 (Contract Testing) is used now. Definition: 契約テストは、別々に展開できる2つのシステムが合意された形式でメッセージを交換しているかどうかを確認します。 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.