pub struct TestHarness { /* private fields */ }Expand description
Test harness for stream testing
Implementations§
Source§impl TestHarness
impl TestHarness
Sourcepub fn builder() -> TestHarnessBuilder
pub fn builder() -> TestHarnessBuilder
Create a new test harness builder
Sourcepub async fn advance_time(&self, duration: Duration)
pub async fn advance_time(&self, duration: Duration)
Advance mock time
Sourcepub async fn push_event(&self, event: StreamEvent) -> Result<()>
pub async fn push_event(&self, event: StreamEvent) -> Result<()>
Push a single event
Sourcepub async fn push_events(&self, events: Vec<StreamEvent>) -> Result<()>
pub async fn push_events(&self, events: Vec<StreamEvent>) -> Result<()>
Push multiple events
Sourcepub async fn generate_events(&self, count: usize) -> Result<()>
pub async fn generate_events(&self, count: usize) -> Result<()>
Generate and push events
Sourcepub async fn add_output(&self, event: StreamEvent)
pub async fn add_output(&self, event: StreamEvent)
Add output event (called by stream processor)
Sourcepub async fn get_output(&self) -> Vec<StreamEvent>
pub async fn get_output(&self) -> Vec<StreamEvent>
Get output events
Sourcepub async fn clear_output(&self)
pub async fn clear_output(&self)
Clear output events
Sourcepub async fn get_captured_events(&self) -> Vec<CapturedEvent>
pub async fn get_captured_events(&self) -> Vec<CapturedEvent>
Get captured events
Sourcepub async fn assert_event_count(&self, expected: usize) -> Result<()>
pub async fn assert_event_count(&self, expected: usize) -> Result<()>
Assert event count
Sourcepub async fn assert_contains(
&self,
predicate: impl Fn(&StreamEvent) -> bool,
) -> Result<()>
pub async fn assert_contains( &self, predicate: impl Fn(&StreamEvent) -> bool, ) -> Result<()>
Assert output contains event
Sourcepub async fn assert_no_events(&self) -> Result<()>
pub async fn assert_no_events(&self) -> Result<()>
Assert no output events
Sourcepub async fn assert_within(
&self,
duration: Duration,
condition: impl Fn(&[StreamEvent]) -> bool,
) -> Result<()>
pub async fn assert_within( &self, duration: Duration, condition: impl Fn(&[StreamEvent]) -> bool, ) -> Result<()>
Assert events within duration
Sourcepub async fn assert_performance(
&self,
metric: PerformanceMetric,
threshold: f64,
) -> Result<()>
pub async fn assert_performance( &self, metric: PerformanceMetric, threshold: f64, ) -> Result<()>
Assert performance metric
Sourcepub async fn get_metrics(&self) -> TestMetrics
pub async fn get_metrics(&self) -> TestMetrics
Get test metrics
Sourcepub async fn get_assertions(&self) -> Vec<Assertion>
pub async fn get_assertions(&self) -> Vec<Assertion>
Get all assertions
Sourcepub async fn generate_report(&self) -> TestReport
pub async fn generate_report(&self) -> TestReport
Generate test report
Auto Trait Implementations§
impl Freeze for TestHarness
impl !RefUnwindSafe for TestHarness
impl Send for TestHarness
impl Sync for TestHarness
impl Unpin for TestHarness
impl UnsafeUnpin for TestHarness
impl !UnwindSafe for TestHarness
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.