-
Notifications
You must be signed in to change notification settings - Fork 35
General Gherkin Structure
Given .... < condition >
When ... < action >
Then ... < assertion >
And ... < additional [assertions, actions, conditions] >
But ... < additional [assertions, actions, conditions] >
Thus, when you have multiple conditions, actions, or assertions in a row:
Given .... < condition >
And ... < additional condition >
When .... < action >
And ... < additional action >
Then .... < assertion >
And ... < additional assertion >
Given I am an "admin" user who logs into REDCap
And I visit "/"
When I visit "Control Center"
And I click the link labeled "My Projects"
Then I should see "Control Center"
And I should see "My Projects"
Behind the scenes - Given, When, Then, And, But - they all work exactly the same!
Thus, the tests will still work regardless of which Gherkin keyword we use.
Choosing the correct keyword is a matter of readability and convention.
It's better to write a test and get some of the keyword convention structure incorrect than to not write a test.
It's also often the case that these keywords need to change as a test evolves.
We can clean these keywords up easily after the steps of a test are determined.