Reputation: 31
For a BDD, is it ok if I skip the given statement or convert a When to And statement?
Upvotes: 1
Views: 1967
Reputation: 32936
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
Upvotes: 2