Skip to content
Ahmed Ali edited this page Aug 17, 2016 · 6 revisions

##@Everyone

A step typically starts with Given, When or Then. If there are multiple Given or When steps underneath each other, you can use And or But. Syntactly any step should start with one of these five keywords, but there is no grammar validation for them. So it is up to you to use them wisely in a way that fits best with your scenario's description.

Given

A Given steps describe the initial state of your application in order to perform the scenario. Syntactly, you can have more than one Given step; however, for better readability, it is recommended to use And or But for additional Given steps.

When

When steps usually describe a specific action, event or a cause; that's it, something that causes something else to happen. The ideal scenario should only have a single When step; having more meaning you might need to consider splitting it into more than one scenario.

Then

Then steps are used to describe an expectation or a result after a specific event.

And and But steps used to provide more flexibility, but should be used wisely to keep your scenarios concise and robust.