Skip to content

Stub runner

Michał Chmielarz edited this page Jan 22, 2016 · 9 revisions

Description

Stub Runner Spring is a Spring configuration of the Stub Runner project. It also is a part of the Micro Deps Spring Config project.

This is the 4finance implementation of the Consumer Driven Contracts.

How does it work?

Stub Runner Spring follows the pattern:

  • As a part of the microservice deps set up Stub Runner Spring takes care of downloading the latest stub mappings from the provided repository.
  • It sets up a Wiremock instance for each collaborator of the given microservice.
  • All of those Wiremock instances register themselves under the testing Zookeeper instance under the path present in the microservice descriptor (e.g. micoservice.json file)
  • When you pick a given collaborator it will be searched for in the testing Zookeeper instance

Ensuring that stubs are up to date:

Looking for the latest stub definitions and downloading them from a remote repository can take a serious amount of time. Thus Stub Runner will first look for stubs in the local repository, and only then in the remote.

To ensure you're using the latest stubs, set configuration property stubrunner.work-offline=false (default is false). Continuous Integration environments should always have this property set to false.

NOTE!

One building a stub remember to put the output Wiremock contracts in a subfolder called mappings. In the future this constraint will be removed but until then please put it there. An example of Accurest DSLs is here - https://github.com/4finance/boot-microservice/tree/master/repository/mappings and the output stubs are configured here https://github.com/4finance/boot-microservice/blob/master/gradle/test.gradle#L7 to be placed under the mappings folder.

Configuration

Properties that can be configured are present here with the stubrunner prefix.

You can’t perform that action at this time.