WireMock as a Service
We are pleased to announce that we now have a new mocking service for WebdriverIO called wdio-wiremock-service
.
#
What can it do?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.
A few things you can do with this service:
- Automatically run WireMock alongside the WebdriverIO testrunner
- Supports usage of mock and fixture files
- Match request URLs, methods, headers cookies and bodies using a wide variety of strategies. First class support for JSON and XML.
- Configure WireMock with all the available options
#
InstallationInstructions on how to install WebdriverIO
can be found here.
#
ConfigurationIn order to use the service you need to add it to your service array:
There are a lot more options that are available for configuration, for a full overview go here.
#
Creating mocks and fixturesThe service creates a directory (./mock
by default) with two subdirectories (mappings
and __files
). It will use the mappings
directory to look for mock files and it will use the __files
directory to look for fixture files.
Knowing this, creating a fixture is as easy as creating a file in the __files
directory:
And creating your first mock is as simple as creating a file in the mappings
directory:
Knowing this, creating a fixture is as easy as creating a file in the __files
directory:
#
Writing testsWriting your first test is really straight forward:
#
SupportStay up to date by joining the community over at Gitter to join others and for support and questions.
See you there!