Chapter 4. The basics of scenario outlines

 

This chapter covers

  • Understanding scenario outlines versus scenarios
  • Removing redundancies in scenarios with DRY
  • Comparing advantages and disadvantages of scenario outlines
  • Maintaining scenario outlines over time

Chapters 2 and 3 explored the art of writing scenarios. You learned several techniques that make creating new scenarios easy and fun. And that’s fantastic! After all, the gentle learning curve is what makes Gherkin so beginner-friendly. But this simplicity is also what makes creating a stable specification suite difficult from a long-term perspective. Gherkin is almost too easy to write, so it’s also easy to pick up bad habits.

While writing this chapter, I looked at several of my first feature files: some were longer than 500 lines, even though most of the scenarios were similar. As I read the full specification, I understood why. The feature was a reporting system for conversion metrics. The scenarios looked as if I wrote a main scenario and then copied it multiple times to play with different metrics, changing only the numbers and trying to make sure the calculations would be implemented exactly as they should be. I had good intentions, but I wasted a lot of space—and the readability wasn’t perfect, either. Looking back, I saw that my desire to be precise backfired. Going through one feature file took almost an hour, as I tried to re-create my thinking. When I finished, I felt sorry for my former teammates.

4.1. Example shopping application

4.2. Using scenario outlines

4.3. The structure of a scenario outline

4.4. Advantages of scenario outlines

4.5. Growing and maintaining scenario outlines

4.6. Disadvantages of scenario outlines

4.7. Summary

sitemap