pub struct AssertionEngine { /* private fields */ }Implementations§
Source§impl AssertionEngine
impl AssertionEngine
Sourcepub fn with_registry(registry: Arc<dyn PluginRegistry>) -> Self
pub fn with_registry(registry: Arc<dyn PluginRegistry>) -> Self
Create a new assertion engine with a custom plugin registry
Sourcepub fn evaluate(
&self,
assertion: &str,
response: &Value,
headers: Option<&HashMap<String, String>>,
trailers: Option<&HashMap<String, String>>,
) -> Result<AssertionResult>
pub fn evaluate( &self, assertion: &str, response: &Value, headers: Option<&HashMap<String, String>>, trailers: Option<&HashMap<String, String>>, ) -> Result<AssertionResult>
Evaluate a single assertion
pub fn evaluate_with_timing( &self, assertion: &str, response: &Value, headers: Option<&HashMap<String, String>>, trailers: Option<&HashMap<String, String>>, timing: Option<&AssertionTiming>, variables: &HashMap<String, Value>, protocol: Option<&str>, ) -> Result<AssertionResult>
Sourcepub fn query(&self, expr: &str, input: &Value) -> Result<Vec<Value>>
pub fn query(&self, expr: &str, input: &Value) -> Result<Vec<Value>>
Execute a JQ query and return the result(s)
pub fn has_failures(&self, results: &[AssertionResult]) -> bool
pub fn get_failures<'a>( &self, results: &'a [AssertionResult], ) -> Vec<&'a AssertionResult>
pub fn evaluate_all( &self, assertions: &[String], response: &Value, headers: Option<&HashMap<String, String>>, trailers: Option<&HashMap<String, String>>, ) -> Vec<AssertionResult>
pub fn evaluate_all_with_timing( &self, assertions: &[String], response: &Value, headers: Option<&HashMap<String, String>>, trailers: Option<&HashMap<String, String>>, timing: Option<&AssertionTiming>, variables: &HashMap<String, Value>, protocol: Option<&str>, ) -> Vec<AssertionResult>
Sourcepub fn evaluate_all_with_records(
&self,
assertions: &[String],
response: &Value,
headers: Option<&HashMap<String, String>>,
trailers: Option<&HashMap<String, String>>,
timing: Option<&AssertionTiming>,
variables: &HashMap<String, Value>,
protocol: Option<&str>,
) -> Vec<(AssertionResult, u64)>
pub fn evaluate_all_with_records( &self, assertions: &[String], response: &Value, headers: Option<&HashMap<String, String>>, trailers: Option<&HashMap<String, String>>, timing: Option<&AssertionTiming>, variables: &HashMap<String, Value>, protocol: Option<&str>, ) -> Vec<(AssertionResult, u64)>
Same as Self::evaluate_all_with_timing, but also returns the wall-clock
time each individual assertion took to evaluate — used to surface
per-assertion timing in reports/explain without re-running the batch.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for AssertionEngine
impl !UnwindSafe for AssertionEngine
impl Freeze for AssertionEngine
impl Send for AssertionEngine
impl Sync for AssertionEngine
impl Unpin for AssertionEngine
impl UnsafeUnpin for AssertionEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more