Function run_test_with_result

Source
pub async fn run_test_with_result<A, S, T, E>(
    app: A,
    options: PrepareOptions,
    test_fn: T,
) -> Result<(), (Option<Error>, Option<E>)>
where S: Clone + Send + Sync + 'static, AppContext: FromRef<S>, A: App<S> + Send + Sync + 'static, T: AsyncFnOnce(&TestAppState<A, S>) -> Result<(), E>, E: Error,
Expand description

Similar to run_test, except allows returning a Result to communicate test success/failure. If the test returns an Err, the teardown logic will still be run. If the test returns an Err, it will then be returned in the Err returned by run_test_with_result itself.

Note: If the test panics, the teardown logic will not be run. To ensure the teardown logic runs, return an error instead of panicking.