9 A new user story
This chapter covers
- Writing a feature file for a new requirement from scratch
- Suggestions about when a scenario should be formulated, and by who
- Tips and techniques for writing readable scenarios
- Further Gherkin syntax that can help keep scenarios readable
- The problems caused by unautomated scenarios
In Chapter 4 we described an idealized BDD approach. In this chapter, we will dig into nodes #3 (Formulate) and #4 (Review) from figure 9.1.
Figure 9.1 Tasks and activities in the BDD approach
In the last chapter we reviewed the scenarios that the team wrote from the “customer- collection” example map. In this chapter we’ll watch the team work on a new requirement. This will demonstrate the interplay between the examples uncovered during discovery and the scenarios that get written during formulation. We’ll see that formulation is best undertaken by a subset of the delivery team, and that there needs to be a commitment from the rest of the team to review the scenarios produced.
You’ll be introduced to several scenario refinement techniques that will enhance readability. Some of them are simple changes in natural language structure, designed to minimize repetition or emphasize idiomatic use of natural language. Others will expose you to some new aspects of Gherkin syntax, such as data tables, scenario outlines, text descriptions and comments.