Skip to main content

AsyncTestLifecycleHook

Trait AsyncTestLifecycleHook 

Source
pub trait AsyncTestLifecycleHook: Send + Sync {
    // Provided methods
    fn before_setup_async<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _env: &'life1 TestEnv,
    ) -> Pin<Box<dyn Future<Output = TestingResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn after_setup_async<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _env: &'life1 TestEnv,
    ) -> Pin<Box<dyn Future<Output = TestingResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn before_teardown_async<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _env: &'life1 TestEnv,
    ) -> Pin<Box<dyn Future<Output = TestingResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn after_teardown_async<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _env: &'life1 TestEnv,
    ) -> Pin<Box<dyn Future<Output = TestingResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

异步测试生命周期钩子 trait

定义测试环境在各个阶段执行的异步钩子函数,支持异步操作的初始化和清理。

Provided Methods§

Source

fn before_setup_async<'life0, 'life1, 'async_trait>( &'life0 self, _env: &'life1 TestEnv, ) -> Pin<Box<dyn Future<Output = TestingResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

在测试环境初始化之前异步执行

§Errors

如果钩子执行失败,将返回 WaeError 错误。

Source

fn after_setup_async<'life0, 'life1, 'async_trait>( &'life0 self, _env: &'life1 TestEnv, ) -> Pin<Box<dyn Future<Output = TestingResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

在测试环境初始化之后异步执行

§Errors

如果钩子执行失败,将返回 WaeError 错误。

Source

fn before_teardown_async<'life0, 'life1, 'async_trait>( &'life0 self, _env: &'life1 TestEnv, ) -> Pin<Box<dyn Future<Output = TestingResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

在测试环境清理之前异步执行

§Errors

如果钩子执行失败,将返回 WaeError 错误。

Source

fn after_teardown_async<'life0, 'life1, 'async_trait>( &'life0 self, _env: &'life1 TestEnv, ) -> Pin<Box<dyn Future<Output = TestingResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

在测试环境清理之后异步执行

§Errors

如果钩子执行失败,将返回 WaeError 错误。

Implementors§