pub struct TestHandle<T> { /* private fields */ }Expand description
A handle to a set of running tests. Tests can either be waited on one-at-a-time (using
TestHandle::wait_next), or in bulk (using TestHandle::wait_all).
Implementations§
Source§impl<T> TestHandle<T>
impl<T> TestHandle<T>
Sourcepub fn tests_left(&self) -> usize
pub fn tests_left(&self) -> usize
Get the quantity of tests that are still running or haven’t been collected using
TestHandle::wait_next.
Sourcepub fn test_count(&self) -> usize
pub fn test_count(&self) -> usize
Get the total quantity of test cases that this test handle keeps track of
Sourcepub fn compile_result(&self) -> Option<&CompileResult>
pub fn compile_result(&self) -> Option<&CompileResult>
Get the result of the compilation step from TestRunner::compile. This returns None
if the tests did not need a compile step.
Source§impl<T: 'static> TestHandle<T>
impl<T: 'static> TestHandle<T>
Sourcepub async fn wait_next(
&mut self,
) -> Result<Option<TestResult<T>>, SpawnTestError>
pub async fn wait_next( &mut self, ) -> Result<Option<TestResult<T>>, SpawnTestError>
Wait for the next test to finish. The test result returned from this is not ordered, but
the index may be received from TestResult::index.
§Cancel Safety
This method is cancel safe. If wait_next is used as the event in a tokio::select!
statement and some other branch completes first, it is guaranteed that no test results
were removed from this TestHandle.
Sourcepub async fn wait_all(&mut self) -> Result<Vec<TestResult<T>>, SpawnTestError>
pub async fn wait_all(&mut self) -> Result<Vec<TestResult<T>>, SpawnTestError>
Wait for all tests to complete and return a vector of test cases. The returned vector is
ordered based on the order in which the tests were inserted in the TestContext.
§Cancel Safety
This method is not cancellation safe. If the method is used as the event in a
tokio::select! statement and some other branch completes first, then some test results
may already have been consumed.