MIRAGE: LLMs Can Replace Real Microservices in Integration Tests with 99% Fidelity — No Mocks Required
Available in: 中文
Traditional microservice testing requires complex mock setups. MIRAGE uses LLMs to simulate dependent services at runtime with 99% fidelity — no pre-generated mocks needed.
Traditional microservice testing requires complex mock setups. MIRAGE uses LLMs to simulate dependent services at runtime with 99% fidelity — no pre-generated mocks needed.
The Problem
Testing microservices that depend on other services is hard:
- Record-replay — Static, breaks when APIs change (62% status code fidelity)
- Pattern mining — Limited to observed patterns
- Specification-driven stubs — Manual, incomplete, brittle
MIRAGE's Approach
Instead of pre-generating mocks, MIRAGE uses an LLM at runtime to answer each dependency request as it arrives:
- Reads dependency source code, caller code, and production traces
- Simulates dependency behavior on demand
- Maintains cross-request state throughout the test scenario
Results
| Metric | MIRAGE | Record-Replay |
|---|---|---|
| Status code fidelity | 99% (109/110) | 62% |
| Response shape fidelity | 99% | 16% |
| End-to-end pass/fail match | 8/8 scenarios | — |
Tested Systems
- Google's Online Boutique
- Weaveworks' Sock Shop
- Custom microservice system
- 110 test scenarios across 14 caller-dependency pairs
Key Insight
"Dependency source code is often sufficient for high-fidelity runtime simulation, even without production traces."
Why It Matters
- Eliminates mock maintenance — No more updating stubs when APIs change
- Faster development — Test against services without deploying them
- CI/CD improvement — Integration tests become practical in pipelines
- Cost reduction — No need to spin up full dependency stacks for testing
← Previous: Bipartisan Calls to Remove Trump From Office Grow Over Iran 'Genocide' ThreatNext: StatsClaw: Multi-Agent Claude Code Architecture for Building Reliable Statistical Software →
0