Designing good test cases
Emily Bache
Practitioner Workshop
Summary
Test Driven Development is a multifaceted skill, that it takes study and practice to master. In this workshop, we’ll be looking at one particular aspect of it – how to design good test cases. During this half day session, we’ll work in pairs, and work on the same code kata problem three times, varying the design of the test cases. Between each coding session we’ll hold a short retrospective, and swap pairs. The coding problem we’ll be working on is the “Gilded Rose” Kata which is an example of some business logic that could do with refactoring, together with a requirements specification, but no tests.
For the three coding sessions I would like to suggest the following three approaches:
- classic JUnit style test cases.
- BDD style test cases using Cucumber.
- Approval testing.
With each approach, workshop participants implement test cases, then lean on them as they refactor the code. My hope is that participants will explore with me how to create tests that are both useful for refactoring, and act to document the functionality in a more precise way than the requirements specification.
Beginners to TDD get an introduction to the skill, and more experienced practitioners will have a chance to reflect on how the choice of testing approach affects the ease of refactoring, and future maintainability of the code.
To make it easier to get set up and coding quickly, we’ll be using the cyber-dojo coding environment. Participants are asked to bring a laptop if possible.
Presenter
Emily Bache has been a software developer and test engineer for nearly 15 years, working in organizations as diverse as small startup and large corporation. These days Emily is an independent consultant specializing in automated testing and agile methods. Emily has recently published a book, “The Coding Dojo Handbook”, based on her work teaching and learning skills like Test Driven Development. Emily has run Coding Dojos at conferences, in companies, with user groups, and has facilitated several Code Retreat events. Emily regularly speaks at international conferences such as XP, Agile Testing Days, ACCU, and currently acts as programme chair for Scandinavian Developer Conference.