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.
- 2 min connect: in pairs, draw TDD cycle.
- 10 min concept: present Double loop TDD
- 10 min demo: explain the Kata and one example
- 20 min practice: create examples and formulate scenarios in pairs
- 10 min reflect: present scenarios in groups
- 5 min reflect: note most important learning
What is the TDD cycle? What activities do you do in each step? Sketch the cycle and note activities. Work in pairs.
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.
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.
In small groups or pairs, get people to come up with more examples and formulate them as scenarios that could be automated.
Get small groups to present their examples and formulations to one another.
Each person should note down in their own words the most important thing they have learnt today.