Struct quick_junit::Report

source ·
pub struct Report {
    pub name: String,
    pub uuid: Option<Uuid>,
    pub timestamp: Option<DateTime<FixedOffset>>,
    pub time: Option<Duration>,
    pub tests: usize,
    pub failures: usize,
    pub errors: usize,
    pub test_suites: Vec<TestSuite>,
}
Expand description

The root element of a JUnit report.

Fields§

§name: String

The name of this report.

§uuid: Option<Uuid>

A unique identifier associated with this report.

This is an extension to the spec that’s used by nextest.

§timestamp: Option<DateTime<FixedOffset>>

The time at which the first test in this report began execution.

This is not part of the JUnit spec, but may be useful for some tools.

§time: Option<Duration>

The overall time taken by the test suite.

This is serialized as the number of seconds.

§tests: usize

The total number of tests from all TestSuites.

§failures: usize

The total number of failures from all TestSuites.

§errors: usize

The total number of errors from all TestSuites.

§test_suites: Vec<TestSuite>

The test suites contained in this report.

Implementations§

source§

impl Report

source

pub fn new(name: impl Into<String>) -> Self

Creates a new Report with the given name.

source

pub fn set_uuid(&mut self, uuid: Uuid) -> &mut Self

Sets a unique ID for this Report.

This is an extension that’s used by nextest.

source

pub fn set_timestamp( &mut self, timestamp: impl Into<DateTime<FixedOffset>> ) -> &mut Self

Sets the start timestamp for the report.

source

pub fn set_time(&mut self, time: Duration) -> &mut Self

Sets the time taken for overall execution.

source

pub fn add_test_suite(&mut self, test_suite: TestSuite) -> &mut Self

Adds a new TestSuite and updates the tests, failures and errors counts.

When generating a new report, use of this method is recommended over adding to self.TestSuites directly.

source

pub fn add_test_suites( &mut self, test_suites: impl IntoIterator<Item = TestSuite> ) -> &mut Self

Adds several TestSuites and updates the tests, failures and errors counts.

When generating a new report, use of this method is recommended over adding to self.TestSuites directly.

source

pub fn serialize(&self, writer: impl Write) -> Result<(), SerializeError>

Serialize this report to the given writer.

source

pub fn to_string(&self) -> Result<String, SerializeError>

Serialize this report to a string.

Trait Implementations§

source§

impl Clone for Report

source§

fn clone(&self) -> Report

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Report

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.