-
I prefer writing my step implementations as synchronous code (instead of async). Example: use std::time::Duration;
#[given("a satiated cat")]
fn satiated_cat(world: &mut AnimalWorld) {
std::thread::sleep(Duration::from_millis(1000));
world.cat.hungry = false;
} However, doing so executes all scenarios sequentially. I assume that's because Cucumber-Rust works asynchronously internally and my sync step implementations block the event loop. Is it possible to configure Cucumber-Rust to execute my Scenarios with sync step implementations concurrently? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@kevgo you can make your sync functions async by using |
Beta Was this translation helpful? Give feedback.
@kevgo you can make your sync functions async by using
tokio::spawn_blocking
/tokio::block_in_place
. You may also want to check something likeasync_scoped
andmoro
forthread::scope
-like API. We would like to do it ourselves, but unfortunately currently there is no runtime-agnostic way to do it.