Crate stubr[−][src]
This crate proposes a reimplementation of Wiremock. Its aims at converting Wiremock stubs into wiremock-rs mocks.
use it
use stubr::{Stubr, Config}; use surf; #[async_std::main] async fn main() { // supply a directory containing json stubs. Invalid files are just ignored let srv = Stubr::start("tests/stubs").await; // or just mount a single file let srv = Stubr::start("tests/stubs/ping.json").await; // or configure it (more configurations to come) let srv = Stubr::start_with("tests/stubs", Config { port: Some(8080), ..Default::default() }).await; // use '.uri()' method to get server address surf::get(srv.uri()).await; }
Structs
Config | Stubr server configuration. |
Stubr | Allows running a Wiremock mock server from Wiremock stubs. Delegates runtime to wiremock-rs. |
Traits
AnyStubServer | Abstraction over a server capable of serving stubs. Mostly used internally in a test context to also execute integration tests against a real Wiremock server instance. |