Feature
Each feature-file starts with the feature-stopword. It’s unique and provides a high-level description of a software feature to group related scenarios.
With Gherkin, you can use your native language to describe test cases instead of difficult to read and understand camelcase test-method-names.
It is designed to be a non-technical and human-readable way of describing use cases in software. Gherkin syntax has a few keywords that indicate a special behavior.
Each feature-file starts with the feature-stopword. It’s unique and provides a high-level description of a software feature to group related scenarios.
A human-readable description follows the feature.
You can write anything you like, as long it doesn’t start with a Gherkin-keyword.
A single Gherkin scenario is a flow of events through the Feature being described and maps 1:1 with an executable test case for the system.
You can have multiple Scenarios in one Feature-file.
A human-readable description follows the scenario.
You can write anything you like, as long it doesn’t start with a Gherkin-keyword.
Given steps are used to describe the initial context of the system – the scene of the scenario. It is typically something that happened in the past.
And-keyword is used to extend to your steps.
Helps you to elaborate your feature-file further.
When keyword defines the test action which will be executed.
By test action we mean the user input action.
Then keyword defines the outcome of previous steps.
You can place tags above Feature to group related features, independent of your file and directory structure.
Furthermore you can filter tags within your CI/CD-pipeline.
Delimited parameters <> are used as references which are referred to in the example tables. SpecFlow will automatically replace these parameters when executing tests.
Data Tables are handy for passing a list of values to a step definition. A useful tool in complex Gherkin examples.
Display, review, and discuss your Gherkin feature files and scenarios at any point that makes sense in your CI/CD process. Overlay test results and automatically update your documentation with every new build.
Gherkin is the beating heart of BDD. It helps users formulate requirements in an easy-to-read language.
More on BDD