Don't Mock! How to Use Contracts to Write Better Tests for Nuxt Applications
summary
Mocking fails once a BFF or Next server routes remove observable HTTP calls, so tests that intercept browser traffic miss server‑to‑server behavior and mock data drifts from real APIs. Uses an OpenAPI spec published to a contract store, runs a Specmatic stop server during tests, and drives the app with Playwright and Next; contract validation rejects breaking API changes so tests fail when a consumer example and the service spec diverge. Demonstrated end‑to‑end testing that prevents silent mock breakage using contract testing and an OpenAPI spec.
AI-written summary · about
chapters (11)
- 0:00Introduction and background
- 1:46Problem with mocking microservices
- 5:22Monolithic vs microservices testing
- 9:39BFF layer complicates testing
- 14:02Why mocking fails in microservices
- 15:51Contract testing as solution
- 19:22OpenAPI specifications explained
- 22:16Contract testing demo setup
- 26:09End-to-end testing with contracts
- 29:01Solving testing problems with contracts
- 29:43Summary and Q&A
