In this tutorial we will use docker to run an instance of wiremock to setup a mock api for us to test our api’s.
Wiremock is a tool for building mock API’s which enables us to build stable development environments.
Docker and Wiremock
Run a wiremock instance with docker:
Then our wiremock instance will be exposed on port 8080 locally, which we can use to make a request against to create a api mapping:
1 2 3 4
The response should be something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
If we make a GET request against our API:
Our response should be:
1 2 3
Export Wiremock Mappings
We can export our mappings to a local file named
Import Wiremock Mappings
We can import our mappings from our
stubs.json file with: