WireMock
ActiveOverview
WireMock is an open-source HTTP mock server that allows developers to stub and verify HTTP requests for testing purposes. It provides a controlled test environment for integration testing, enabling fast, repeatable, and independent tests without relying on external systems. WireMock is particularly useful for testing external API dependencies in Spring Boot applications and other Java-based projects, supporting both standalone deployment and embedded usage within test suites.
Key Features
- HTTP Request Stubbing - Create mock responses for HTTP endpoints to simulate external API behavior without actual server communication.
- Request Verification - Verify that HTTP requests were made with expected parameters, headers, and payloads.
- Conditional Proxying - Selectively proxy requests to real services while intercepting and modifying specific traffic for testing.
- Browser Proxying - Configure WireMock as a forward proxy to modify AJAX requests or swap out CSS/JavaScript files for website testing.
- Record and Playback - Record real API responses and replay them as stubs for consistent test scenarios.
- Profile Configuration - Apply named configuration overlays to maintain a single base configuration with selective modifications for different contexts.
- Spring Boot Integration - Declarative configuration and annotation-based setup for embedding WireMock instances in JUnit tests.
- Multiple Server Instances - Inject and configure multiple independent WireMock servers for testing applications with numerous external dependencies.
Pricing
| Plan | Price | Includes |
|---|---|---|
| Open Source | Free | Full WireMock functionality, community support, self-hosted deployment |
| WireMock Cloud | Contact for pricing | Managed cloud hosting, team collaboration, advanced monitoring and analytics |
Platforms & Requirements
WireMock runs on any platform with Java support, including Linux, macOS, and Windows. It can be deployed as a standalone server or embedded within Java applications and Spring Boot test suites. Minimum requirements include Java Runtime Environment (JRE); specific version requirements depend on the WireMock release being used.
Integrations & Ecosystem
- Spring Boot
- JUnit
- IntelliJ IDEA
- Maven
- Gradle
- Docker
- Kubernetes
- HTTP Client tools
Alternatives
| App | Difference |
|---|---|
| Mockoon | Standalone desktop application with GUI for API mocking, less integrated with Java/Spring ecosystems. |
| Prism | OpenAPI-first mock server with automatic mock generation from specifications, broader language support. |
| Postman Mock Servers | Cloud-based mocking integrated with Postman's API development platform, less suitable for automated testing. |
| VCR.py / Betamax | Record and playback libraries for specific languages (Python, Ruby, Java), less flexible for complex stubbing scenarios. |
Reputation
WireMock is widely recognized as a reliable and mature tool for HTTP mocking in Java and Spring Boot testing environments. It is praised for its flexibility, comprehensive stubbing capabilities, and strong integration with popular testing frameworks. The open-source nature and active community support are significant strengths, though some users note a steeper learning curve compared to simpler mocking tools and occasional documentation gaps for advanced features.
Sources (9)
- https://docs.wiremock.io/concepts/profiles
- https://www.baeldung.com/spring-boot-wiremock
- https://wiremock.org/docs/proxying/
- https://www.jetbrains.com/help/idea/wiremock.html
- https://wiremock.org/docs/spring-boot/
- https://wiremock.org/docs/configuration/
- https://github.com/spring-cloud/spring-cloud-contract/issues/1555
- https://groups.google.com/g/wiremock-user/c/q5ZYS9A9vxo
- https://www.oreilly.com/videos/wiremock-for-java/9781839210747/9781839210747-video5_1/