Discover and Formulate Scenarios for the Lift Kata

When you’re doing TDD, how do you know what to test? The starting point is usually some kind of requirements specification, and/or discussions with a business representative. This learning hour is about how to discover and formulate scenarios and get your TDD cycle started. If you hold a second learning hour on the same Kata, you can use these scenarios to drive double-loop TDD.

Session Outline

Connect

What is the TDD cycle? What activities do you do in each step? Sketch the cycle and note activities. Work in pairs.

Concept

Sketch Double-Loop TDD on a whiteboard. Explain the inner loop is the ordinary Red-Green-Refactor loop that we have done before. The outer loop is Failing scenario - Passing scenario - Refactor. The rhythm of the outer loop is slower. A scenario exercises a thicker chunk of code than a unit test. A scenario is understandable by everyone in the team, including business representatives.

Demonstrate

Explain the Lift Kata and show the list of requirements, (see the ‘materials’ section). You can act as the business representative if they have questions about the requirements.

Come up with an example, note it on a whiteboard where everyone can see. Formulate it into a scenario and also write that on the whiteboard.

I think this exercise is particularly suitable for formulating scenarios as sketches and then doing Approval testing. If you prefer, use the ‘given-when-then’ Gherkin syntax to formulate scenarios.

Practice

In small groups or pairs, get people to come up with more examples and formulate them as scenarios that could be automated.

Reflect

Get small groups to present their examples and formulations to one another.

Conclusions

Each person should note down in their own words the most important thing they have learnt today.