pub struct OutputDirectoryBuilder { /* private fields */ }
Expand description
A helper for accumulating results in an output directory.
|OutputDirectoryBuilder| handles details specific to the format of the test output format, such as the locations of summaries and artifacts, while allowing the caller to accumulate results separately. A typical usecase might look like this:
let output_directory = OutputDirectoryBuilder::new("/path", SchemaVersion::V1)?;
let mut run_result = TestRunResult {
common: Cow::Owned(CommonResult{
name: "run".to_string(),
artifact_dir: output_directory.new_artifact_dir("run-artifacts")?,
outcome: Outcome::Inconclusive.into(),
start_time: None,
duration_milliseconds: None,
}),
suites: vec![],
};
// accumulate results in run_result over time... then save the summary.
output_directory.save_summary(&run_result)?;
Implementations§
Source§impl OutputDirectoryBuilder
impl OutputDirectoryBuilder
Sourcepub fn new(
dir: impl Into<PathBuf>,
version: SchemaVersion,
) -> Result<Self, Error>
pub fn new( dir: impl Into<PathBuf>, version: SchemaVersion, ) -> Result<Self, Error>
Register a directory for use as an output directory using version |version|.
Sourcepub fn new_artifact_dir(&self) -> Result<ArtifactSubDirectory, Error>
pub fn new_artifact_dir(&self) -> Result<ArtifactSubDirectory, Error>
Create a new artifact subdirectory.
The new |ArtifactSubDirectory| should be referenced from either the test run, suite, or case when a summary is saved in this OutputDirectoryBuilder with |save_summary|.
Sourcepub fn save_summary<'a, 'b>(
&'a self,
result: &'a TestRunResult<'b>,
) -> Result<(), Error>
pub fn save_summary<'a, 'b>( &'a self, result: &'a TestRunResult<'b>, ) -> Result<(), Error>
Save a summary of the test results in the directory.
Auto Trait Implementations§
impl Freeze for OutputDirectoryBuilder
impl RefUnwindSafe for OutputDirectoryBuilder
impl Send for OutputDirectoryBuilder
impl Sync for OutputDirectoryBuilder
impl Unpin for OutputDirectoryBuilder
impl UnwindSafe for OutputDirectoryBuilder
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