Software:WireMock

From HandWiki
WireMock
WireMock Logo - Wide.svg
Original author(s)Tom Akehurst
Initial release2011
Repositoryhttps://github.com/wiremock
Written inJava
PlatformJava 11, Java 17
TypeIntegration Testing, API
LicenseApache License v2
Websitehttps://wiremock.org/

WireMock is a popular open-source tool for API simulations (aka API mocking, and hence the name). It is used for Integration Testing of various application interfaces, especially REST API.

Started in 2011 as a Java library by Tom Akehurst, WireMock now spans multiple programming languages and technology stacks. It helps to create stable test and development environments, isolate code from flakey 3rd parties, and simulate APIs that aren’t currently available. It can run as a library or client wrapper in many languages, or as a standalone server. There is a large community and ecosystem behind the project [1].

WireMock supports several approaches for creating mock APIs - in code, via its REST API, as JSON files and by recording HTTP traffic proxied to another destination. WireMock has a request matching system, allowing any part of an incoming request to be matched against complex and precise criteria. Responses can be dynamically generated via the Handlebars based templating system. Finally, WireMock can be integrated into development workflows thanks to its extension points.

Features

WireMock can run in many Unit testing and Integration testing frameworks, including JUnit, TestNG, Testcontainers, Spock and others. It can be also deployed as a standalone service in Docker, Kubernetes or as a Java executable.

Key features include:

  • HTTP response stubbing, matchable on URL, header and body content patterns
  • Request verification
  • Record/playback of API mocking stubs
  • Configurable response delays and Fault injection
  • Per-request conditional proxying
  • Browser proxying for request inspection and replacement
  • Stateful behavior simulation

All the features are configurable via a fluent Java API and JSON files, or via JSON over HTTP for the standalone service.

History

WireMock was created in 2011 by Tom Akehurst when working for ioko. The project was released to the public on the 9th of October 2011 under the Apache License v2. It quickly gained traction in the Java community and got adopted in many projects.

In 2016, WireMock 2.0 was released. Approximately at the same time, Docker images were introduced to the project by Rodolphe Chaigneau.

In 2022, a new WireMock Inc. company was formed around WireMock, with Tom Akehurst becoming its CTO and Uri Maoz as the CEO. The company builds WireMock Cloud - a SaaS solution and a developer portal for API development productivity platform. In May 2023 WireMock Inc. received a seed investment round and re-emphasized its commitment to the open source ecosystem and growing the community [2].

In 2023, a formal governance model was introduced in the project as part of the effort to grow the contributor community and the ecosystem. A public roadmap was published for the project [3]. Tom Akehurst became the BDFL of the project, a charter of co-maintainers was introduced.

The next major release which the community works on is WireMock 3 [4]. This release is planned to include many new request filters and other features, drop Java 1.8 support, and reduce the dependencies footprint by using new Java capabilities. There are additional initiatives in the works, including support for gRPC and GraphQL mocking, Testcontainers support, etc.

Ecosystem

WireMock has a diverse ecosystem of extensions, adapters and integrations for different technologies. These allow WireMock to be used with different programming languages and technologies, especially within the Java Virtual Machine ecosystem.

Popular integrations include:

Other Implementations

WireMock has many 3rd-party implementations for different technology stacks. These implementations are maintained outside the WireMock community governance. They may or may not be fully compatible with WireMock’s official implementation in Java.

Popular server implementations:

There are many other implementations using WireMock Docker and providing wrappers for it, for example Python[8], Golang or JavaScript. There is ongoing effort to consolidate these implementations with help of Testcontainers.

See Also

References