wdio-wiremock-service
A WebdriverIO service to start & stop WireMock
WebdriverIO WireMock Service
This service helps you to run WireMock seamlessly when running tests with WebdriverIO. It uses the well know maven repository to download the WireMock jar for you which is then automatically installed and started.
Installation
Before starting make sure you have JDK installed.
The easiest way is to keep wdio-wiremock-service
as a devDependency in your package.json
.
{
"devDependencies": {
"wdio-wiremock-service": "^2.25.1-1"
}
}
You can simply do it by:
npm install wdio-wiremock-service --save-dev
Instructions on how to install WebdriverIO
can be found here.
Configuration
In order to use the service you need to add it to your service array:
// wdio.conf.js
export.config = {
// ...
services: ['wiremock'],
// ...
};
Options
The following options can be added to the service.
port
Port where WireMock should run on.
Type: Number
Default: 8080
Example:
// wdio.conf.js
export.config = {
// ...
services: [
['wiremock', { port: 8181 }]
],
// ...
};
rootDir
Path where WireMock will look for files.
Type: String
Default: ./mock
Example:
// wdio.conf.js
export.config = {
// ...
services: [
['wiremock', { rootDir: './mock' }]
],
// ...
};
stdio
Level of logging (for simplicity this can be set to: pipe
, ignore
, inherit
).
For more information see stdio.
Type: Array | String
Default: inherit
Example:
// wdio.conf.js
export.config = {
// ...
services: [
['wiremock', { stdio: 'inherit' }]
],
// ...
};
mavenBaseUrl
Base download url for Maven.
Type: String
Default: https://repo1.maven.org/maven2
Example:
// wdio.conf.js
export.config = {
// ...
services: [
['wiremock', { mavenBaseUrl: 'https://repo1.maven.org/maven2' }]
],
// ...
};
For more information on WebdriverIO see the homepage.