TheBrainFamily / cypress-cucumber-example

Example of using Cypress with Cucumber
MIT License
194 stars 122 forks source link

gherkin and when step #16

Open spham opened 4 years ago

spham commented 4 years ago

hi it seems missing "when" in alls steps. why ?

pravynandas commented 4 years ago

Sorry, what is "alls steps" ?

spham commented 4 years ago

in gherkin. we always have given. when. then. all demos have only given and when. why ?

pravynandas commented 4 years ago

Remember, gherkin steps are evaluated on the step definition. So a step defined as When(), Then(), Given() can be used for any the step implementation in feature file. Meaning, the terms When, Then, Given can be interchanged (along with And, But) where it is appropriate. Perhaps about your question, the examples were so simple and may not have a reason to add Then.

For me, I have one entire feature defined just with 'defineStep()' which I use for all of the Given, When, Then, And & But. Each ones approach is different, but it works.