pub trait Reporter: Send + Sync {
// Required methods
fn new_entity(&self, entity: &EntityId, name: &str) -> Result<(), Error>;
fn set_entity_info(&self, entity: &EntityId, info: &EntityInfo);
fn entity_started(
&self,
entity: &EntityId,
timestamp: Timestamp,
) -> Result<(), Error>;
fn entity_stopped(
&self,
entity: &EntityId,
outcome: &ReportedOutcome,
timestamp: Timestamp,
) -> Result<(), Error>;
fn entity_finished(&self, entity: &EntityId) -> Result<(), Error>;
fn new_artifact(
&self,
entity: &EntityId,
artifact_type: &ArtifactType,
) -> Result<Box<dyn Write + Send + Sync + 'static>, Error>;
fn new_directory_artifact(
&self,
entity: &EntityId,
artifact_type: &DirectoryArtifactType,
component_moniker: Option<String>,
) -> Result<Box<dyn DirectoryWrite + Send + Sync + 'static>, Error>;
}
Expand description
A trait for structs that report test results.
Implementations of Reporter
serve as the backend powering RunReporter
.
As with std::io::Write
, Reporter
implementations are intended to be composable.
An implementation of Reporter
may contain other Reporter
implementors and delegate
calls to them.
Required Methods§
Sourcefn new_entity(&self, entity: &EntityId, name: &str) -> Result<(), Error>
fn new_entity(&self, entity: &EntityId, name: &str) -> Result<(), Error>
Record a new test suite or test case. This should be called once per entity.
Sourcefn set_entity_info(&self, entity: &EntityId, info: &EntityInfo)
fn set_entity_info(&self, entity: &EntityId, info: &EntityInfo)
Add additional info for an entity.
Sourcefn entity_started(
&self,
entity: &EntityId,
timestamp: Timestamp,
) -> Result<(), Error>
fn entity_started( &self, entity: &EntityId, timestamp: Timestamp, ) -> Result<(), Error>
Record that a test run, suite or case has started.
Sourcefn entity_stopped(
&self,
entity: &EntityId,
outcome: &ReportedOutcome,
timestamp: Timestamp,
) -> Result<(), Error>
fn entity_stopped( &self, entity: &EntityId, outcome: &ReportedOutcome, timestamp: Timestamp, ) -> Result<(), Error>
Record that a test run, suite, or case has stopped.
Sourcefn entity_finished(&self, entity: &EntityId) -> Result<(), Error>
fn entity_finished(&self, entity: &EntityId) -> Result<(), Error>
Record that a test run, suite, or case has stopped. After this method is called for
an entity, no additional events or artifacts may be added to the entity.
Implementations of Reporter
may assume that entity_finished
will be called no more
than once for any entity.
Sourcefn new_artifact(
&self,
entity: &EntityId,
artifact_type: &ArtifactType,
) -> Result<Box<dyn Write + Send + Sync + 'static>, Error>
fn new_artifact( &self, entity: &EntityId, artifact_type: &ArtifactType, ) -> Result<Box<dyn Write + Send + Sync + 'static>, Error>
Create a new artifact scoped to the referenced entity.
Sourcefn new_directory_artifact(
&self,
entity: &EntityId,
artifact_type: &DirectoryArtifactType,
component_moniker: Option<String>,
) -> Result<Box<dyn DirectoryWrite + Send + Sync + 'static>, Error>
fn new_directory_artifact( &self, entity: &EntityId, artifact_type: &DirectoryArtifactType, component_moniker: Option<String>, ) -> Result<Box<dyn DirectoryWrite + Send + Sync + 'static>, Error>
Create a new artifact consisting of multiple files.