wiremock-stub-mapping-tracker

Wiremock extensions to track stub mapping usage

License

License

The Apache Software License, Version 2.0
Categories

Categories

Wire Data Data Structures
GroupId

GroupId

com.github.masonm
ArtifactId

ArtifactId

wiremock-stub-mapping-tracker
Last Version

Last Version

0.1
Release Date

Release Date

Type

Type

jar
Description

Description

wiremock-stub-mapping-tracker
Wiremock extensions to track stub mapping usage
Project URL

Project URL

https://github.com/MasonM/wiremock-stub-mapping-tracker
Source Code Management

Source Code Management

https://github.com/MasonM/wiremock-stub-mapping-tracker

Download wiremock-stub-mapping-tracker

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.masonm/wiremock-stub-mapping-tracker/ -->
<dependency>
    <groupId>com.github.masonm</groupId>
    <artifactId>wiremock-stub-mapping-tracker</artifactId>
    <version>0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.masonm/wiremock-stub-mapping-tracker/
implementation 'com.github.masonm:wiremock-stub-mapping-tracker:0.1'
// https://jarcasting.com/artifacts/com.github.masonm/wiremock-stub-mapping-tracker/
implementation ("com.github.masonm:wiremock-stub-mapping-tracker:0.1")
'com.github.masonm:wiremock-stub-mapping-tracker:jar:0.1'
<dependency org="com.github.masonm" name="wiremock-stub-mapping-tracker" rev="0.1">
  <artifact name="wiremock-stub-mapping-tracker" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.masonm', module='wiremock-stub-mapping-tracker', version='0.1')
)
libraryDependencies += "com.github.masonm" % "wiremock-stub-mapping-tracker" % "0.1"
[com.github.masonm/wiremock-stub-mapping-tracker "0.1"]

Dependencies

test (6)

Group / Artifact Type Version
com.github.tomakehurst : wiremock jar 2.14.0
junit : junit jar 4.12
org.hamcrest : hamcrest-all jar 1.3
org.skyscreamer : jsonassert jar 1.2.3
org.apache.httpcomponents : httpmime jar 4.5
com.github.tomakehurst : wiremock jar 2.14.0

Project Modules

There are no modules declared in this project.

Overview

Build Status Maven Central

wiremock-stub-mapping-tracker is a set of WireMock extensions for tracking which stub mappings have been used in a request and easily deleting unmatched mappings. This is useful in conjunction with Record and Playback for pruning generated stub mappings. Tracking is done independently of the request journal.

Requires Java 1.8+

Building

Run ./gradlew jar to build the JAR without dependencies or ./gradlew fatJar to build a standalone JAR. These will be placed in build/libs/.

Running

Standalone server:

java -jar build/libs/wiremock-stub-mapping-tracker-0.1-standalone.jar

With WireMock standalone JAR:

wget -nc http://repo1.maven.org/maven2/com/github/tomakehurst/wiremock-standalone/2.14.0/wiremock-standalone-2.14.0.jar
java \
        -cp wiremock-standalone-2.14.0.jar:build/libs/wiremock-stub-mapping-tracker-0.1.jar \
        com.github.tomakehurst.wiremock.standalone.WireMockServerRunner \
        --extensions="com.github.masonm.StubMappingTrackerAdminExtension,com.github.masonm.StubMappingTrackerPostServeExtension"

Programmatically in Java:

new WireMockServer(wireMockConfig()
    .extensions("com.github.masonm.StubMappingTrackerAdminExtension", "com.github.masonm.StubMappingTrackerPostServeExtension"))

Usage

  • POST /__admin/mappings_tracker/reset - Clear journal of tracked stub mappings
  • GET /__admin/mappings_tracker/matched - Return all stub mappings that have matched a request
  • GET /__admin/mappings_tracker/unmatched - Return all stub mappings that haven't matched a request
  • DELETE /__admin/mappings_tracker/unmatched - Delete all stub mappings that haven't matched a request

Versions

Version
0.1