service-virtualization
帮助选择合适的隔离策略并在 CI 中防止真实依赖泄露,适合复杂集成环境。
会使用 Docker/Testcontainers 等组件,需主机支持与额外权限。
提供决策框架与实现方案,在测试中隔离或模拟外部依赖并防止真实调用泄露。
给测试里隔离外部依赖提供决策与实现方案,按场景选进程内 mock、HTTP stub(MSW、WireMock)、record‑replay、故障注入(Toxiproxy)或临时真服务(Testcontainers)。在写集成或端到端测试时,用它避免真实 API 被调用或外部波动干扰测试结果。特点是优先在 HTTP 层做 stub,并在 CI 中确保真实调用不泄露,保证测试稳定可复现。
▸ 展开 SKILL.md 英文原文
Decision framework for isolating every external dependency in a test suite: when to use in-process mocks, HTTP stubs (MSW, WireMock), record-replay, fault injection (Toxiproxy), or ephemeral real services (Testcontainers), and how to enforce that no real calls escape in CI. Use when: "mock service," "stub API," "fake service," "WireMock," "MSW," "Toxiproxy," "test isolation," "dependency management," "stub an external API in CI." Not for: consumer-driven contract verification (Pact, broker) — use contract-testing; standing up a full Docker Compose env or seed data — use test-environments; broad resilience/game-day fault campaigns — use chaos-engineering. Related: contract-testing, test-environments, api-testing, test-data-management, chaos-engineering.
帮我安装这个 skill:https://raw.githubusercontent.com/petrkindlmann/qa-skills/main/skills/service-virtualization/SKILL.mdcurl -fsSL "https://raw.githubusercontent.com/petrkindlmann/qa-skills/main/skills/service-virtualization/SKILL.md"<objective> Mock Stripe at the SDK layer and your tests pass green while production 500s the moment Stripe changes a response field — because the stub was never tied to a contract. This skill picks the right isolation strategy per dependency (in-process mock, HTTP stub, record-replay, fault injection, or ephemeral real service), stubs at the HTTP layer so tests survive SDK upgrades, and makes the CI run fail when any real call escapes the stubs. </objective> ## Quick Route | Situation | Go to | |-----------|-------| | Node/browser test hitting an external HTTP API | MSW → `references/msw.md` | | Polyglot CI, complex matching, or you need a standalone stub server | WireMock → `references/wi