Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After hook is odd to work with #207

Closed
jeromegn opened this issue Mar 8, 2022 · 2 comments · Fixed by #209
Closed

After hook is odd to work with #207

jeromegn opened this issue Mar 8, 2022 · 2 comments · Fixed by #209
Assignees
Labels
bug Something isn't working
Milestone

Comments

@jeromegn
Copy link

jeromegn commented Mar 8, 2022

I'm attempting to convert some of our automated testing to use cucumber-rs, but I'm finding it hard to tear down my tests.

If the last step fails, the after hook doesn't provide a World to work with. I need the World to get to its state and make decisions on tear down.

My after hook:

#[tokio::main]
async fn main() {
    BalloonWorld::cucumber()
        .max_concurrent_scenarios(1)
        .after(|_, _, _, maybe_world| {
            println!("AFTER! {:?}", maybe_world);
            Box::pin(async move {
                println!("AFTER IN FUT {:?}", maybe_world);
            })
        })
        .run_and_exit("features")
        .await;
}

image

What's the recommended way to make this work?

Basically we're creating Fly.io apps and then we need to make sure they are tore down, whatever the outcome of the tests.

@tyranron tyranron added the bug Something isn't working label Mar 9, 2022
@tyranron
Copy link
Member

tyranron commented Mar 9, 2022

@ilslv please, re-check. Once the World is initialized, it should be available in the After Hook.

@jeromegn another option to tear down is to do so in Drop for the World. We use such a techique a lot in our code bases, and don't use After Hook at all.

@tyranron
Copy link
Member

@jeromegn released in 0.12.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants