Use Cases
Contract testing and flake hardening
Build repeatable contract checks and resilience scenarios locally using strict routing, deterministic responses, and controlled latency/failure behavior.
Purpose
Catch payload and behavior regressions before integrating with unstable upstream systems.
Where this is used
- Pre-merge local verification for API-consuming clients.
- Manual smoke checks for response contracts and failure handling.
- Reproducing flaky network conditions in a controlled environment.
Setup and prerequisites
- Mockphine desktop app running with target server configured.
- Server fallback set intentionally (`STRICT` is recommended for contract checks).
- Contract-critical endpoints created in `MOCK` mode.
Step-by-step workflow
- Set fallback mode to `STRICT` so unknown routes fail fast as `404 Not Mocked`.
- Create/update endpoint bodies to match expected API contract responses.
- Start server and run your request scripts against local server URL.
- Add delay/failure simulation on selected endpoints to test retry paths.
- Use Live View logs to confirm status, duration, and `served-by` source.
- Adjust endpoint definitions until checks are stable and deterministic.
Expected result and output
- Contract checks run against stable local responses.
- Unexpected routes fail clearly in strict mode.
- Failure and latency scenarios are reproducible across test runs.
Common issues and fixes
- Requests leak to upstream: verify fallback mode and endpoint modes are not passthrough-capable.
- Checks fail with `strict_404`: add missing routes or fix method/path/query settings.
- Delay/failure has no effect: ensure target endpoint is in `MOCK` mode.
Contract and resilience validation
Screenshot placeholder
Placeholder: strict routing checks plus delay/failure simulation outcomes.
