Skip to main content
Tool comparison
COMPARE  /  wiremock-vs-pact

WireMock vs Pact

WireMock and Pact answer different questions. WireMock simulates an API so you can test a consumer in isolation: stub responses, match requests, add latency and faults. Pact checks that the real provider still satisfies what each consumer actually uses, by generating a contract from consumer tests and verifying it on the provider side. Most microservice teams need both.

WireMock
An open-source API mock server that stubs HTTP responses, matches requests, records real traffic, injects faults and runs as a Java library, standalone JAR or Docker container.
Pact
A code-first consumer-driven contract testing tool: consumer tests generate a contract, the provider verifies it, and a broker tracks which versions are safe to deploy.

How do WireMock and Pact compare?

WireMock vs Pact, compared by dimension
What it verifiesWireMockThat your code behaves correctly against responses you definedPactThat the provider actually returns what each consumer relies on
Where the truth livesWireMockIn your stubs, which can drift from the real API without anyone noticingPactIn a contract generated from consumer tests and verified against the provider
Who runs whatWireMockThe consumer team runs its tests against the mockPactThe consumer test produces a pact; the provider build verifies it
How it runsWireMockJava library, standalone JAR, Docker, an npm package, or WireMock CloudPactLibraries in more than ten languages, plus the Pact Broker or PactFlow
LanguagesWireMockJava and JVM first; Python, Node.js, Go, Rust and others through clientsPactJavaScript, JVM, .NET, Go, Python, Swift, Ruby, PHP, Rust, C++ and more
ProtocolsWireMockHTTP and HTTPS, including proxying to a real APIPactHTTP and message-based systems; gRPC, Avro and others through plugins
Beyond happy pathsWireMockFault injection, latency, response templating, record and playbackPactContract by example: each interaction is a concrete request and response pair
Deployment safetyWireMockNone; a mock cannot tell you the real API changedPactcan-i-deploy checks the broker before a version ships
LicenceWireMockOpen source, Apache 2.0; WireMock Cloud is commercialPactOpen source, MIT; PactFlow is commercial

When should you choose WireMock, and when Pact?

Choose WireMock when

  • You need to test a consumer against responses the real API cannot easily produce: errors, timeouts, slow responses.
  • The upstream API is third-party, unavailable in test, or costs money per call.
  • You want fast, deterministic component tests for a service with many dependencies.
  • You need to record real traffic once and replay it in CI.

Choose Pact when

  • Several teams own the services and integration breakages surface late.
  • You want to know before deploying whether a provider change breaks a consumer.
  • End-to-end environments are slow, flaky or contested and you want to retire some of them.
  • The provider is owned in-house and can run a verification step in its own build.

How does WireMock vs Pact come up in QA interviews?

This is a senior question because it is really about what your tests prove. A candidate who says WireMock and Pact are alternatives has not felt the failure that Pact prevents: a mock that kept passing after the real API changed. Say what each tool verifies, and where you have used both.

  1. 01You have thorough WireMock tests and the provider ships a breaking change. What happens to your tests, and what would have caught it?
  2. 02Explain consumer-driven contract testing and why the consumer, not the provider, writes the contract.
  3. 03Where do stubs and contracts live in your pipeline, and what does can-i-deploy actually check?
  4. 04When is contract testing not worth its overhead?
Answer 2 Free Questions

No account needed · Scored in under a minute against a senior rubric

Common questions about WireMock vs Pact

Is Pact a replacement for WireMock?

No. Pact verifies compatibility between a consumer and its provider; WireMock simulates a provider so the consumer can be tested alone. A Pact consumer test uses a mock service to record the interactions, but that mock is only the recording device. Teams typically keep WireMock for edge cases and use Pact to guard the integration.

Does WireMock do contract testing?

Not by itself. WireMock stubs are written by the consumer team and are never checked against the real provider, so they can drift silently. Contract testing adds the provider-side verification, which is what Pact provides.

Is Pact only for microservices?

It is most valuable where several teams own services that call each other and integration environments are expensive. Pact also covers message-based systems, not just HTTP. For a single team owning both sides, a shared integration test may be simpler.

Which should I learn first?

WireMock, because stubbing an API is a daily task in automation and it takes an afternoon. Learn Pact when you work on a system with multiple teams, and be ready to explain the consumer-provider flow and the broker in interviews for senior SDET roles.

EXEC.NOW

Ready to be asked about WireMock or Pact?

Practice explaining the trade-off to an interviewer who knows both.

Join 500+ QA engineers already practicing with AssertHired.

Question 1 · Automation · Mid-levellive scoring

A test passes locally but fails in CI about one run in five. Walk me through what you check first, and why.

Scored on the same four dimensions as the real thing: Technical accuracy · Coverage · Clarity · Best practices.

Rather skip ahead? Create a free account

FREE.TO.START  ·  7.DAY.TRIAL ON PAID PLANS
Written by , Senior QA Automation Engineer, 50+ QA candidate interviews conductedLast updated July 2026