stubr

Build status

Adaptation of wiremock-rs supporting existing Wiremock json stubs as input.
Aims at reaching feature parity with Wiremock and be a drop-in replacement of the latter.

use it

as a crate

```rust use stubr::Stubr;

let srv = Stubr::start("tests/stubs").await; // or just mount a single file let srv = Stubr::start("tests/stubs/ping.json").await;

// use '.uri()' method to get server address surf::get( & srv.uri()).await; ```

as a cli

You can use stubr as a cli for serving Wiremock stubs on a local server.
To get a list of all available options run

bash stubr --help

The simplest usage is for serving Wiremock stubs under a directory. Example for a project exposing contracts using Spring Cloud Contract

```bash ./gradlew generateClientStubs stubr build/stubs/META-INF/com.ecorp/my-app/SNAPSHOT/mappings

You can also specify the directory as wiremock does with the --root-dir arg.
You can enforce server port with --port or -p arg. By default, stubr starts on a random port.

install it

with precompiled binaries (linux & osx)

linux:

bash curl -L https://github.com/beltram/stubr/releases/download/0.1.0/stubr-linux -o /usr/local/bin/stubr && chmod +x /usr/local/bin/stubr

macos (Catalina):

NOTE: Big Sur users are recommended to install with cargo or from source

bash curl -L https://github.com/beltram/stubr/releases/download/0.1.0/stubr-macos -o /usr/local/bin/stubr && chmod +x /usr/local/bin/stubr

with cargo

bash cargo install stubr

from source (linux & osx)

bash git clone --depth 1 https://github.com/beltram/stubr.git && cd stubr && cargo build --release && mv target/release/stubr /usr/local/bin/

then generate completion

Completion files generation is currently supported for bash and zsh. Stubr cli provides a completion command to generate and install them in a standard location.

```bash stubr completion zsh

or

stubr completion bash ```

benchmark

A very simple benchmark is available here