8 Our first feature
This chapter covers:
- Feature file structure and syntax in detail
- The main Gherkin keywords and how they should be used
- Differentiating between context, action, and outcome
- Using data tables and scenario outlines
Gherkin requires you to organize your scenarios into feature files. There’s no limit to how large (or small) your feature files are, but you should always remember that your goal is well structured, readable documentation.
Each feature file should focus on a single area of functionality in your product. As features get more complicated, you may find it useful to spread the documentation over several feature files. In Chapter 10, “Organizing the documentation”, we will talk in depth about how to structure documentation as it grows. For this chapter, we’re going to limit discussion to a single feature file.
The feature file that the team has just written describes how the system should enable a customer to place an order for customer-collection. The scenarios in this feature file are cohesive – they all illustrate related behavior of the software.
8.1 A sample feature file
The team has written scenarios for the example map that they built in the last chapter and replaced the old scenario completely. The scenarios have been collected into a feature file, which is shown in listing 8.1 and is also available at https://github.com/bddbooks/bddbooks-formulation-wimp/tree/main/ch3-beginning.