chapter nine

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.

9.1 Write it upwards

9.2 Too many cooks

9.2.1 Why not formulate during the discovery session?

9.2.2 Shouldn’t the whole team formulate together?

9.2.3 Don’t the Product Owners (POs)/Business Analysts (BAs) own the specifications?

9.2.4 Shouldn’t the developers/testers focus on the implementation?

9.2.5 Isn’t it more efficient for one person to do it?

9.2.6 Should the same people always do the formulation?

9.3 Quotation marks

9.4 There’s no “I” in “Persona”

9.5 Does repetition matter?

9.6 The Background keyword

9.7 Unformulated examples

9.8 Commenting in feature files

9.9 Setting the context

9.10 Stay focused on illustrating the rule

9.11 Formulation gets faster

9.12 Incremental specification

9.13 Manual scenarios

9.14 Who does what and when

9.15 Summary