-
Hi all, I have just recently moved from Java to .NET and, therefore, from Cucumber to Reqnroll. As of now the transition has been seamless, except for one detail, which I am not sure whether it is a feature or a bug. So, before opening an issue, I was thinking to ask it here. Well, the title of the discussion is the question itself, so let me elaborate a bit here with examples. For example we have a step definition with the attribute of When:
In some scenarios it makes sense indeed to use it as a When step, while in others it could also be used as a Given step. In the current 1.0.1 version of Reqnroll if we create a step in a feature with the Given attribute to the step defined with When attribute, we get an error stating that "Test could not be run".
Is it intended to be like this? I am mostly curious because in Cucumber the attribute has a pure linguistic role and is not mapped 1:1 to the attribute declared in the step definition. Thank you very much for reading this post and I wish you a wonderful day ahead! P.S. This is my first ever post on a Github discussion board and also in a project with open-source community. If I made any mistakes, please let me know :) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
The given, when, then are tightly coupled to the place in the scenario, yes. And AFAIK have always been in specflow and now Reqroll. (If you start a scenario with just And it will also imply/infer you meant Given and search for a step marked with that.) I don't know if the tight coupling was actually a conscious choice, but it does allow you to have two different implementations for an otherwise equal given, when and even then step. Never ran into a situation that was handy, but hey, it is there. Marking the step with two attributes is quite common in at least the projects I've worked on. |
Beta Was this translation helpful? Give feedback.
-
@Biwya The only addition to the answer of @ajeckmans that if you really need, you can use the |
Beta Was this translation helpful? Give feedback.
The given, when, then are tightly coupled to the place in the scenario, yes. And AFAIK have always been in specflow and now Reqroll.
(If you start a scenario with just And it will also imply/infer you meant Given and search for a step marked with that.)
I don't know if the tight coupling was actually a conscious choice, but it does allow you to have two different implementations for an otherwise equal given, when and even then step. Never ran into a situation that was handy, but hey, it is there.
Marking the step with two attributes is quite common in at least the projects I've worked on.