Skip to content

Latest commit

 

History

History
55 lines (38 loc) · 1.25 KB

README.md

File metadata and controls

55 lines (38 loc) · 1.25 KB
render_macros

Faker Extension for WireMock

Uses Data Faker to generate random, fake data for using in WireMock responses.

Usage

Step 1: Add to your build file

For Maven users:

<dependency>
    <groupId>org.wiremock.extensions</groupId>
    <artifactId>wiremock-faker-extension</artifactId>
    <version>0.2.0</version>
</dependency>

For Gradle users:

dependencies {
    implementation 'org.wiremock.extensions:wiremock-faker-extension-standalone:0.2.0'
}

Step 2: Register the extension with your server

Then, register this extension as you would any other:

new WireMockServer(wireMockConfig().extensions(RandomExtension.class));

Step 3: Use it in your stubs!

{% raw %}

{{ random 'Name.first_name' }}

{% endraw %}

This will generate random first names in the en-US locale for every request.

Technical notes

This library brings net.datafaker:datafaker as transitive dependency, which may result in conflicts at building time. If that's the case, the net.datafaker:datafaker dependency needs to be excluded.

For a full reference of the available keys, see the Reference Documentation.