pub struct Reporter { /* private fields */ }Expand description
Test reporter with Andon Cord support
The reporter collects test results and can generate various output formats. In AndonCord mode, it stops on the first failure.
§Example
ⓘ
let mut reporter = Reporter::andon(); // Fail-fast mode
reporter.record(TestResultEntry::passed("test_1", Duration::from_millis(100)))?;
reporter.record(TestResultEntry::failed("test_2", Duration::from_millis(50), "assertion failed"))?;
// ^ This will return Err(AndonCordPulled)Implementations§
Source§impl Reporter
impl Reporter
Sourcepub fn collect_all() -> Self
pub fn collect_all() -> Self
Create reporter with CollectAll mode
Sourcepub fn record(&mut self, result: TestResultEntry) -> ProbarResult<()>
pub fn record(&mut self, result: TestResultEntry) -> ProbarResult<()>
Sourcepub fn add_screenshot(
&mut self,
name: impl Into<String>,
screenshot: Screenshot,
)
pub fn add_screenshot( &mut self, name: impl Into<String>, screenshot: Screenshot, )
Add a screenshot
Sourcepub fn add_visual_diff(&mut self, name: impl Into<String>, diff: VisualDiff)
pub fn add_visual_diff(&mut self, name: impl Into<String>, diff: VisualDiff)
Add a visual diff
Sourcepub fn passed_count(&self) -> usize
pub fn passed_count(&self) -> usize
Get number of passed tests
Sourcepub fn failed_count(&self) -> usize
pub fn failed_count(&self) -> usize
Get number of failed tests
Sourcepub fn total_count(&self) -> usize
pub fn total_count(&self) -> usize
Get total test count
Sourcepub fn all_passed(&self) -> bool
pub fn all_passed(&self) -> bool
Check if all tests passed
Sourcepub fn total_duration(&self) -> Duration
pub fn total_duration(&self) -> Duration
Get total duration
Sourcepub fn results(&self) -> &[TestResultEntry]
pub fn results(&self) -> &[TestResultEntry]
Get test results
Sourcepub fn failures(&self) -> Vec<&TestResultEntry>
pub fn failures(&self) -> Vec<&TestResultEntry>
Get failing tests
Sourcepub fn generate_html(&self, output_path: &Path) -> ProbarResult<()>
pub fn generate_html(&self, output_path: &Path) -> ProbarResult<()>
Sourcepub fn render_html(&self) -> String
pub fn render_html(&self) -> String
Render HTML report content
Sourcepub fn generate_junit(&self, output_path: &Path) -> ProbarResult<()>
pub fn generate_junit(&self, output_path: &Path) -> ProbarResult<()>
Sourcepub fn render_junit(&self) -> String
pub fn render_junit(&self) -> String
Render JUnit XML content
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Reporter
impl RefUnwindSafe for Reporter
impl Send for Reporter
impl Sync for Reporter
impl Unpin for Reporter
impl UnsafeUnpin for Reporter
impl UnwindSafe for Reporter
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