This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
Hi all.
I was considering doing The Ray Tracer Challenge in Rust, so I was looking for a good Cucumber library.
I found the cucumber-rs crate, but the examples made it look like I had to name all my step definitions twice, and I'd prefer not to write boilerplate.
To be completely unambiguous about it, the duplication is here:
#[then("she is full")] // <- naming the step def here
async fn is_full(w: &mut World) { // <- and again here
I don't think that the occurrences of it in the steps themselves counts as duplication—that's effectively like a function call. But here at the definition, having to both annotate and name the step definition, when the name isn't even being used, is what I am calling boilerplate - it serves no purpose. And as you can see, even in their own example, the two got out of sync with each other. The function name here should be she_is_full
but hasn't been updated to match.
Since Rust has closures, it really seems like this duplication should not be necessary, as Cucumber in other languages with closures has not required it.
When I filed a ticket to ask for a cleaner way to define step definitions, someone just shut the ticket down without fixing anything at all. So I'm not sure what to think right now.
At the moment, I'm leaning towards, Rust is just one of those languages where the devs love to write boilerplate. Personally, if I wanted to do write boilerplate, I would have stuck with Java. I moved to Kotlin from Java years ago due to my dislike of boilerplate, and there's no way in hell I'll be jumping ship to Rust if so far, as far as I can tell, the quality of life is lower.
But maybe cucumber-rs is just a bad crate and there is another crate which is good, so my question is, what is the name of the good crate, the one where I can write my Cucumber step definitions without being forced to write boilerplate?
Subreddit
Post Details
- Posted
- 7 months ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/rust/commen...