relentless_http/
lib.rs

1//! HTTP implementation of comparison testing framework [relentless].
2//!
3//! # Binary Usage
4//! About the same as [relentless]
5//! | step | command |
6//! | --- | --- |
7//! | install binary | `cargo install --git https://github.com/hayas1/relentless relentless-http --features cli` |
8//! | install dev server | `cargo install --git https://github.com/hayas1/relentless relentless-http-dev-server` |
9//! | run command | `relentless-http -f compare.yaml` |
10//!
11//! # Library Usage
12//! ## Install
13//! Often used in dev-dependencies.
14//! ```sh
15//! cargo add --dev --git https://github.com/hayas1/relentless relentless-http
16//! ```
17//! ```toml
18//! [dev-dependencies]
19//! relentless-http = { git = "https://github.com/hayas1/relentless" }
20//! ```
21//!
22//! ## Testing
23//! ```
24//! # tokio_test::block_on(async {
25//! use axum::body::Body;
26//! use relentless::interface::{
27//!     command::{Assault, Relentless},
28//!     config::{Config, Format},
29//! };
30//! use relentless_http::command::HttpAssault;
31//! use relentless_http_dev_server::route;
32//!
33//! let assault = HttpAssault::<Body, Body>::new(Relentless {
34//!     file: vec![], // files can be specified also
35//!     ..Default::default()
36//! });
37//! let config = r#"
38//!     name: basic http comparison test
39//!     destinations:
40//!         actual: http://localhost:3000
41//!         expect: http://localhost:3000
42//!
43//!     testcases:
44//!     - target: /
45//!     - target: /health
46//!     - target: /healthz
47//! "#;
48//!
49//! let configs = vec![Config::read_str(config, Format::Yaml).unwrap()];
50//! let service = route::app_with(Default::default());
51//! let report = assault.assault_with(configs, service).await.unwrap();
52//!
53//! assert!(assault.pass(&report));
54//! # })
55//! ```
56
57#[cfg(feature = "default-http-client")]
58pub mod client;
59pub mod command;
60pub mod error;
61pub mod evaluate;
62pub mod factory;
63pub mod record;