vitest-cucumber icon indicating copy to clipboard operation
vitest-cucumber copied to clipboard

Suggestion: Alternatives expressions

Open Odonno opened this issue 1 year ago • 2 comments

Following the #144 proposition, discussed here the feasibility and the need for Alternative expressions feature.

Description

A less common feature is the ability to offer alternatives in the step text.

I have {int} cucumber(s) in my belly/stomach

This would match either of those texts:

I have 1 cucumber in my belly
I have 1 cucumber in my stomach
I have 42 cucumbers in my stomach
I have 42 cucumbers in my belly

References

https://github.com/cucumber/cucumber-expressions?tab=readme-ov-file#optional-text https://docs.specflow.org/projects/specflow/en/latest/Bindings/Cucumber-Expressions.html#optionals-alternatives

Odonno avatar Oct 19 '24 09:10 Odonno

I reed some docs but I don't find a use case to understand this feature. It's usable only with expression like {int} ?

Or a step like Given Developper on public/private projects is a good example ?

amiceli avatar Oct 28 '24 21:10 amiceli

Yep, your last example could work. But in general, it is for when you want to use a synonym. In your example, it is an antonym, I suppose it can work in some contexts.

I do not have a great example as I do not use this feature. Like I said, if someome needs this feature, he can share a viable example so we can work on that.

Odonno avatar Oct 28 '24 21:10 Odonno