|0.4.4||Jun 4, 2021|
|0.4.3||Apr 12, 2021|
|0.3.4||Mar 23, 2021|
|0.2.2||Feb 19, 2021|
#44 in Testing
114 downloads per month
You can use
stubr as a cli for serving Wiremock stubs on a local server or as proxy for recording http traffic into json stubs.
To get a list of all available options run
The simplest usage is for serving Wiremock stubs under a directory.
Example for a project exposing contracts using Spring Cloud Contract
./gradlew generateClientStubs stubr build/stubs/META-INF/com.ecorp/my-app/SNAPSHOT/mappings > + mounted "./build/stubs/META-INF/com.ecorp/my-app/SNAPSHOT/mappings/find-all.json" > + mounted "./build/stubs/META-INF/com.ecorp/my-app/SNAPSHOT/mappings/find-by-id.json" > Started stubr in 50ms on http://127.0.0.1:49604
||Folder containing stubs or individual stub.||
||Directory containing a
||Server port. Defaults to random port.||
||Global delay duration applied to all stubs (supersedes any locally defined delay).||
||Delay added to any locally defined delay. Simulates network latency.||
||Generates & installs bash or zsh completion scripts||
Also available as a crate.
curl -L https://github.com/beltram/stubr/releases/latest/download/stubr-linux.tar.gz | tar xz - -C /usr/local/bin
curl -L https://github.com/beltram/stubr/releases/latest/download/stubr-macos.tar.gz | tar xz - -C /usr/local/bin
cargo install stubr-cli
git clone --depth 1 https://github.com/beltram/stubr.git && cd stubr && cargo build --release && mv target/release/stubr /usr/local/bin/
Completion files generation is currently supported for
zsh. Stubr cli provides a
completion command to
generate and install them in a standard location.
stubr completion zsh # or stubr completion bash
In order to record http traffic,
stubr can act as a proxy to dump this traffic into json stubs on your local filesystem.
Recording can be started with the
stubr record command. Stubs will be grouped by hosts. You can then play them back
||Proxy port. Defaults to 3030.||
||File path where recorded stubs are stored. Default to current directory.||
Also available as a crate for recording traffic in unit tests.
A very simple benchmark comparing stubr to wiremock is available here