Request Matching: WireMock vs Powerduck
Quick answer
Short answer: WireMock matches more conditions than any spec-derived tool, including JSONPath and XPath; a spec mock matches what the contract declares. The first is the right tool for complex matching inside JVM tests; the second is the right surface for keeping every client aligned to the API.
Short answer: WireMock matches more conditions than any spec-derived tool, including JSONPath and XPath; a spec mock matches what the contract declares. The first is the right tool for complex matching inside JVM tests; the second is the right surface for keeping every client aligned to the API.
What deep matching is built for
URL patterns, headers, query parameters, body content, JSONPath, and XPath. It is the right tool for a precise, bespoke condition.
What contract matching is built for
| Property | Deep matching | Contract matching |
|---|---|---|
| Conditions | Very broad | Declared by spec |
| Language | JVM | Any |
| Validity | As written | By construction |
| Maintenance | Code | Spec |
Why the declared surface matters
A cross-language team needs every client aligned to the same contract, not to a bespoke JVM condition. The spec mock serves that surface.
The decision rule
Use deep matching for a complex JVM condition. Use contract matching for a shared, language-agnostic target.
This is part of the Powerduck vs WireMock comparison. Next, read contract tests vs stubs.
Frequently asked questions
What is deep matching built for?
URL patterns, headers, query parameters, body content, JSONPath, and XPath. It is the right tool for a precise, bespoke condition.
What is contract matching built for?
PropertyDeep matchingContract matching ConditionsVery broadDeclared by spec LanguageJVMAny ValidityAs writtenBy construction MaintenanceCodeSpec
Why does the declare surface matters?
A cross-language team needs every client aligned to the same contract, not to a bespoke JVM condition. The spec mock serves that surface.
What is the decision rule?
Use deep matching for a complex JVM condition. Use contract matching for a shared, language-agnostic target. This is part of the Powerduck vs WireMock comparison. Next, read contract tests vs stubs.