WireMock Service
wdio-wiremock-service is a 3rd party package, for more information please see GitHub | npm
This service helps you to run WireMock seamlessly when running tests with WebdriverIO. It uses the well known Maven repository to download the WireMock jar for you which is then automatically installed, started and stopped. Stay up to date by joining the community over at Gitter for help and support.
Installation
npm i -D wdio-wiremock-service
Instructions on how to install WebdriverIO
can be found here.
Usage
In the root directory (default ./mock
) you find two subdirectories, __files
and mappings
which are used for your fixtures and mocks.
For more information, checkout WireMock's official documentation.
Configuration
In order to use the service with the wdio testrunner you need to add it to your service array:
// wdio.conf.js
export.config = {
// ...
services: ['wiremock'],
// ...
};
When using webdriverio standalone you need to add the service and trigger the onPrepare
and onComplete
hooks manually. An example can be found here (the example makes use of Jest):