Try WireMock Cloud
Create publicly hosted mock APIs without anything to install.
Explore mocking in the Cloud >
Try WireMock Cloud
Create publicly hosted mock APIs without anything to install.
Explore mocking in the Cloud >
WireMock Java is distributed in two flavours - a standard JAR containing just WireMock, and a standalone uber JAR containing WireMock plus all its dependencies.
Most of the standalone JAR’s dependencies are shaded i.e. they are hidden in alternative packages. This allows WireMock to be used in projects with conflicting versions of its dependencies. The standalone JAR is also runnable (see Running as a Standalone Process).
WireMock currently has two releases available. The 3.x release (below) and the new 4.x beta releases.
Add the following to your project’s pom.xml dependencies:
<dependency> <groupId>org.wiremock</groupId> <artifactId>wiremock</artifactId> <version>3.13.2</version> <scope>test</scope></dependency>Then follow the next steps for JUnit 5+ or plain Java.
Add the following to your project’s build.gradle:
testImplementation "org.wiremock:wiremock:3.13.2"Then follow the next steps for JUnit 5+ or plain Java.
Add the following to your project’s build.gradle:
testImplementation("org.wiremock:wiremock:3.13.2")Then follow the next steps for JUnit 5+ or plain Java.
Add the following to your project’s build.gradle:
libraryDependencies +="org.wiremock" % "wiremock" % "3.13.2" % TestThen follow the next steps for JUnit 5+ or plain Java.
Run the following in a terminal:
docker run -it --rm -p 8080:8080 --name wiremock wiremock/wiremock:3.13.2<dependency> <groupId>org.wiremock</groupId> <artifactId>wiremock-standalone</artifactId> <version>3.13.2</version> <scope>test</scope></dependency>testImplementation "org.wiremock:wiremock-standalone:3.13.2"testImplementation("org.wiremock:wiremock-standalone:3.13.2")Learn more in the Docker guide.
If you want to run WireMock as a standalone process you can download the standalone JAR from here
The 4.x release of WireMock is currently in beta. These releases are under active development and we recommend you try it out. We would love
to hear your feedback over on the community slack - https://slack.wiremock.org/
We have given these releases a beta label due to the fact that as we move forwards with the 4.x release there will be
breaking changes. See the version 4 page for details on the current updates to the 4.x release.
The version 4 codebase has been refactored to break out the core of WireMock from the various dependencies on external libraries. This means that you can now choose which dependencies you want to include in your project.
Add the following to your project’s pom.xml dependencies. If JUnit 4 is used instead of JUnit 5 then replace wiremock-junit5
with wiremock-junit4.
<dependency> <groupId>org.wiremock</groupId> <artifactId>wiremock-core</artifactId> <version>4.0.0-beta.20</version> <scope>test</scope></dependency><dependency> <groupId>org.wiremock</groupId> <artifactId>wiremock-jetty</artifactId> <version>4.0.0-beta.20</version> <scope>test</scope></dependency><dependency> <groupId>org.wiremock</groupId> <artifactId>wiremock-junit5</artifactId> <version>4.0.0-beta.20</version> <scope>test</scope></dependency><dependency> <groupId>org.wiremock</groupId> <artifactId>wiremock-httpclient-apache5</artifactId> <version>4.0.0-beta.20</version> <scope>test</scope></dependency>Add the following to your project’s build.gradle. If JUnit 4 is used instead of JUnit 5 then replace wiremock-junit5
with wiremock-junit4.
testImplementation "org.wiremock:wiremock-core:4.0.0-beta.20"testImplementation "org.wiremock:wiremock-jetty:4.0.0-beta.20"testImplementation "org.wiremock:wiremock-junit5:4.0.0-beta.20"testImplementation "org.wiremock:wiremock-httpclient-apache5:4.0.0-beta.20"Add the following to your project’s build.gradle.kts. If JUnit 4 is used instead of JUnit 5 then replace wiremock-junit5
with wiremock-junit4.
testImplementation("org.wiremock:wiremock-core:4.0.0-beta.20")testImplementation("org.wiremock:wiremock-jetty:4.0.0-beta.20")testImplementation("org.wiremock:wiremock-junit5:4.0.0-beta.20")testImplementation("org.wiremock:wiremock-httpclient-apache5:4.0.0-beta.20")Add the following to your project’s build.sbt. If JUnit 4 is used instead of JUnit 5 then replace wiremock-junit5
with wiremock-junit4.
libraryDependencies +="org.wiremock" % "wiremock-core" % "4.0.0-beta.20" % TestlibraryDependencies +="org.wiremock" % "wiremock-jetty" % "4.0.0-beta.20" % TestlibraryDependencies +="org.wiremock" % "wiremock-junit5" % "4.0.0-beta.20" % TestlibraryDependencies +="org.wiremock" % "wiremock-httpclient-apache5" % "4.0.0-beta.20" % TestThen follow the next steps for JUnit 5+ or plain Java.
Run the following in a terminal:
<dependency> <groupId>org.wiremock</groupId> <artifactId>wiremock-standalone</artifactId> <version>4.0.0-beta.20</version> <scope>test</scope></dependency>testImplementation "org.wiremock:wiremock-standalone:4.0.0-beta.20"testImplementation("org.wiremock:wiremock-standalone:4.0.0-beta.20")If you want to run WireMock as a standalone process you can download the standalone JAR from here