Wiremock admin extension to find and remove unused stub mappings
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
gradle/wrapper
src
.gitignore
.travis.yml
LICENSE
README.md
build.gradle
gradlew
gradlew.bat
test-script.sh
wiremock-unused-stubs-extension.iml

README.md

Overview

Build Status Maven Central

wiremock-unused-stubs-extension is an admin extension for WireMock that adds a new endpoint, /__admin/unused_mappings, for finding and removing stub mappings that have not matched any requests in the journal. This is useful in conjunction with Record and Playback for pruning generated stub mappings.

Building

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

Running

Standalone server:

java -jar build/libs/wiremock-unused-stubs-extension-0.2-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-unused-stubs-extension-0.2.jar \
        com.github.tomakehurst.wiremock.standalone.WireMockServerRunner \
        --extensions="com.github.masonm.wiremock.UnusedStubsAdminExtension"

Programmatically in Java:

new WireMockServer(wireMockConfig()
    .extensions("com.github.masonm.wiremock.UnusedStubsAdminExtension"))

Usage

Call GET /__admin/unused_mappings to retrieve an array of stub mappings that have not matched any requests in the request journal. Call DELETE /__admin/unused_mappings to remove all such stub mappings.