TestResult

Struct TestResult 

Source
pub struct TestResult {
    pub execution: TestExecution,
    pub status: TestStatus,
    pub generated_files: Vec<PathBuf>,
    pub mismatches: Vec<GoldenMismatch>,
    pub logs: String,
    pub error: Option<String>,
}
Expand description

Complete test result with outcome

Fields§

§execution: TestExecution

Execution metadata

§status: TestStatus

Test status/outcome

§generated_files: Vec<PathBuf>

Files generated by ggen sync

§mismatches: Vec<GoldenMismatch>

Golden file mismatches (if any)

§logs: String

Captured stdout/stderr

§error: Option<String>

Error message (if failed)

Implementations§

Source§

impl TestResult

Source

pub fn passed(execution: TestExecution, files: Vec<PathBuf>) -> Self

Create a passing test result

Source

pub fn failed(execution: TestExecution, error: String, logs: String) -> Self

Create a failing test result

Source

pub fn timed_out( execution: TestExecution, timeout: Duration, logs: String, ) -> Self

Create a timed out test result

Source

pub fn skipped(execution: TestExecution, reason: String) -> Self

Create a skipped test result

Source

pub fn add_mismatch(&mut self, mismatch: GoldenMismatch)

Add a golden file mismatch

Source

pub fn is_success(&self) -> bool

Check if test passed

Source

pub fn summary(&self) -> String

Get summary string

Source

pub fn to_junit_xml(&self) -> String

Generate JUnit XML representation

Trait Implementations§

Source§

impl Debug for TestResult

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for TestResult

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.