For a BDD, is it ok if I skip the given statement or convert a When to And statement?
- 1Would be easier to answer this question, if you supplied a little context. What is your feature? What is your scenario? Why are you wondering whether the given should be skipped or not? What do you mean by "conver a When to And"? Can you update with some examples?Greg Gauthier– Greg Gauthier2015-12-21 13:14:55 +00:00Commented Dec 21, 2015 at 13:14
1 Answer
If your scenario requires no setup, then skipping the Given step is ok I think. I'm not sure it makes sense to skip any of the other steps, as the When is the action step and if you are not performing any action then what are you testing?
It is also possible to write steps which have no implementation if they make you scenarios more readable so you could have something like this:
Given a standard installation of the application When I open the app Then the app splash screen should be displayed The Given step might be empty here (if a standard installation is already performed by some setup and the additional setup is performed by other steps) but its inclusion makes the scenario make more sense. (This is not a great example I realise, but it hopefully conveys the point)
As for changing the When to an And, yes you can do this as this is the point of the And and the But keywords, to make the steps more readable. They effectively have the meaning of 'repeat whatever the current keyword is for this step as well' so and And after a When is the same as another When