Contract, End-to-End, and Failure Tests
Contracts validate schemas, status codes, required fields, and error semantics; end-to-end tests validate customer journeys.
How to apply it
Test duplicate webhooks, expired tokens, revoked membership, provider timeouts, queue retries, database conflicts, malformed imports, and billing sandbox flows. Capture request IDs and traces on failure.
Worked example
Submit the same webhook twice and verify a subscription transition occurs once.
Common mistakes to avoid
Using live payments in tests or retrying flaky tests indefinitely.
Practice task
Implement this concept in the capstone. Add one positive test, one negative or failure-path test, and a short note explaining the trade-off you chose.
Key Takeaways
- Contracts validate schemas, status codes, required fields, and error semantics; end-to-end tests validate customer journeys.
- Test duplicate webhooks, expired tokens, revoked membership, provider timeouts, queue retries, database conflicts, malformed imports, and billing sandbox flows.
Knowledge Check
What is the strongest production practice for Contract, End-to-End, and Failure Tests?