Struct quick_junit::TestCase
source · [−]#[non_exhaustive]pub struct TestCase {
pub name: String,
pub classname: Option<String>,
pub assertions: Option<usize>,
pub timestamp: Option<DateTime<FixedOffset>>,
pub time: Option<Duration>,
pub status: TestCaseStatus,
pub system_out: Option<Output>,
pub system_err: Option<Output>,
pub extra: IndexMap<String, String>,
}Expand description
Represents a single test case.
Fields (Non-exhaustive)
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: StringThe name of the test case.
classname: Option<String>The “classname” of the test case.
Typically, this represents the fully qualified path to the test. In other words,
classname + name together should uniquely identify and locate a test.
assertions: Option<usize>The number of assertions in the test case.
timestamp: Option<DateTime<FixedOffset>>The time at which this test case began execution.
This is not part of the JUnit spec, but may be useful for some tools.
time: Option<Duration>The time it took to execute this test case.
status: TestCaseStatusThe status of this test.
system_out: Option<Output>Data written to standard output while the test case was executed.
system_err: Option<Output>Data written to standard error while the test case was executed.
extra: IndexMap<String, String>Other fields that may be set as attributes, such as “classname”.
Implementations
sourceimpl TestCase
impl TestCase
sourcepub fn new(name: impl Into<String>, status: TestCaseStatus) -> Self
pub fn new(name: impl Into<String>, status: TestCaseStatus) -> Self
Creates a new test case.
sourcepub fn set_classname(&mut self, classname: impl Into<String>) -> &mut Self
pub fn set_classname(&mut self, classname: impl Into<String>) -> &mut Self
Sets the classname of the test.
sourcepub fn set_assertions(&mut self, assertions: usize) -> &mut Self
pub fn set_assertions(&mut self, assertions: usize) -> &mut Self
Sets the number of assertions in the test case.
sourcepub fn set_timestamp(
&mut self,
timestamp: impl Into<DateTime<FixedOffset>>
) -> &mut Self
pub fn set_timestamp(
&mut self,
timestamp: impl Into<DateTime<FixedOffset>>
) -> &mut Self
Sets the start timestamp for the test case.
sourcepub fn set_system_out(&mut self, system_out: impl AsRef<str>) -> &mut Self
pub fn set_system_out(&mut self, system_out: impl AsRef<str>) -> &mut Self
Sets standard output.
sourcepub fn set_system_out_lossy(
&mut self,
system_out: impl AsRef<[u8]>
) -> &mut Self
pub fn set_system_out_lossy(
&mut self,
system_out: impl AsRef<[u8]>
) -> &mut Self
Sets standard output from a Vec<u8>.
The output is converted to a string, lossily.
sourcepub fn set_system_err(&mut self, system_err: impl AsRef<str>) -> &mut Self
pub fn set_system_err(&mut self, system_err: impl AsRef<str>) -> &mut Self
Sets standard error.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for TestCase
impl Send for TestCase
impl Sync for TestCase
impl Unpin for TestCase
impl UnwindSafe for TestCase
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more