Closed tylerhartwig closed 5 years ago
I would call this intended functionality.
TickSpec isn't the only BDD framework which differentiates the step types, e.g. I think SpecFlow does the same. However, SpecFlow has both [<When>]
, [<Then>]
, [<Given>]
attributes and it also has [<StepDefinition>]
attribute which would be closer to what Cucumber does but I didn't see that used much.
We could potentially have such attribute but you can do the same today by writing:
let [<Given; When; Then>] ``I have defined a step definition`` () = ()
Semantically the And
and But
keywords can be seen just as a replacement for one of Given
, When
, and Then
keywords based on context.
Ah, I did not realize I could add Given
, When
, and Then
to the same step definition. That allows me to accomplish what I'm looking for I believe. I've always treated all the keywords as the exact same thing in my mind. Thank you for the help :)
I believe, according to the behavior I am seeing in some of my tests, and in the source code, that step definitions are implemented in a way that is different than the Gherkin definition.
https://docs.cucumber.io/gherkin/reference/#steps
According to the definition the key word (
Given
,When
, orThen
) should not be taken into account when initially loading a step definition. However, you should not be allowed to useGiven
andThen
on the same step definition within the same scenario.I have the case where I've defined a
When
step definition using theWhen
Attribute, but I am invoking that step definition underneath aGive
(usingAnd
however). When running with Xunit, I am told that I am missing a step definition.My setup looks something like the following, for clarity:
Step definition
Please let me know if this is not intended functionality, or if it is functioning as intended. This was just unexpected behavior compared to my previous BDD experience.