This page lists all exercises I have created for Coding Dojos and workshops, each with a short description how to use it. The difficulty is given according the Dreyfus Model for Skill Acquisition: novice, advanced (beginner), competent, proficient and expert level. I have grouped the katas into areas which they are targeting. Enjoy!
xUnit Test Framework Usage
Unit Testing-Koans:
One of the first exercises I created were the Testing Koans. Koans are sequences of little exercises, in this case covering individual features of xUnit test frameworks. Later I added support for some more languages.
This is a novice exercise which will teach you the basic features of xUnit frameworks, e.g. assertions, lifecycle and fixtures.
I have used them in various public workshops, e.g. at ViennaPHP 2015, Software Quality Days 2017 and PyDays 2018.
Finding and Creating Test Cases
Electric Rose
is a stripped down version of the Gilded Rose. You need to write unit tests for some piece of code, following detailed requirements. In contrary to the Gilded Rose, the Electric Rose just needs fewer test cases.
This is a novice exercise where you practice creating unit tests following given requirements. It can be completed in under two hours.
Parrot Requirements Kata
is a small requirements finding exercise inspired by the Parrot Refactoring Kata. Is contains exactly the same production code - calculating the speed of different kinds of parrots - but unlike the refactoring exercise it does not come with tests. Following a fuzzy requirement specification, you have to come up with test cases.
This is a novice exercise where you practice deriving test cases from requirements. See The Right-BICEP.
The exercise was created together with Görge Albrecht.
Rabatt Rechner (Discount Calculator)
is a specialised exercise for finding tests cases around boundary conditions. The code calculates different levels of discounts based on the total amount of your purchase. Unfortunately there are no explicit requirements.
This is a novice exercise where you practice finding test cases around boundary conditions. Check out the the CORRECT Boundary Conditions.
The exercise was created together with Paul Rohorzka and Görge Albrecht.
Working with Test Doubles
Device Driver Mocking Kata
is based on the Device Driver Kata by Emily Bache. It contains the (simplified) device driver that operates a flash memory device. There are no tests. Because of the nature of the device driver you need test doubles ("Mocks", in fact Stubs and Mocks) to test the given code.
This is a slightly advanced exercise where you practice creating test cases using test doubles.
The exercise was created together with Görge Albrecht.
LCD Numbers Mocking Kata
is an implementation of the LCD Numbers Kata. I created the code using outside-in development and then added more classes to spice it up. There are no tests and you need to create unit tests using test doubles for everything. There is a detailed diagram explaining all collaborators.
This is an expert level kata. It is hard and there are way too many collaborators to replace. If you decide to try it, you will get some good practice in working with test doubles.
Design and Test Driven Development
Das Österreiche Aktenzeichen:
This might seem a bit odd, but stay with me. The Austrian Aktenzeichen is the reference number used in court cases in Austria. It contains several numbers and identifiers combined into a single composite reference. Your task is to create the model, parse different string representations and output to different formats.
This is a competent level kata where you can practice your object oriented design skills.
BankOCR Outside-in
repository contains setup code for Bank OCR to work outside-in. In particular there is a failing guiding test and the empty, outside interface of the API you need to create.
This is a competent level kata where you can practice outside-in or London School TDD.
I have presented this in public workshops, e.g. at Software Quality Days 2019. (And here is a solution in Scheme.)
Test Driving User Interfaces
Login Form - TDD a UI
contains starter code to TDD a simple UI. Your task is to create a Login window, form or web page. Read more about the kata here.
This is a more advanced exercise. Testing user interfaces and especially test driving them can be difficult. I have tried it on classic state based, immediate mode as well as Android UIs.
Refactoring Katas
Refactoring katas come with tests, often completely covering the existing code.
Promotion Service
is a small refactoring exercise with an anaemic domain model. It was created during an unconference challenge to create small exercises. You can finish the refactoring in less than one hour.
This is a novice exercise where you practice refactoring towards Object Orientation.
It was created together with Dmitry Kandalov.
Golfed Game of Tron
is based on the Javascript game of Tron in 219 bytes prepared as Refactoring Kata. I expanded some of the more extreme golfing tricks to make the code a bit readable. The code is very compact and lacks proper names and abstractions. It is also a playable game, which is fun while testing.
This is a proficient or maybe expert level kata. The golfed code is crazy and tests exercise the code through the UI. Without any doubt, when working through it you will practice some serious refactoring.
Trivia OO (Object Oriented)
is based on the famous Trivia used in Legacy Coderetreats. Unlike the original Trivia, which is not object oriented, this version of Trivia is "super object oriented" - there is a class for each line of code using technical and mostly wrong abstractions.
This is an advanced exercise where you mainly practice refactoring between objects. Cleaning it up will be a lot of work.
LCD Numbers (Remove) DI-Framework Kata
tasks you to remove the dependency injection framework, e.g. Spring or NAutowired. The code is based on the LCD Numbers Mocking Kata explained above. The original idea by Nat Pryce was to "replace use of a dependency injection framework with plain old functions and classes that model the application domain."
This is an advanced exercise where you practice refactoring away from frameworks.
Much of the existing code was contributed by Nat Pryce.
Legacy Code (Refactoring) Katas
Legacy code exercises are the most difficult. They do not have any tests, and even creating them is often hard because of design issues in the code.
Dependency Breaking Katas
are a series of small exercises to practice breaking dependencies in legacy code and to create tests for it. Each task is focused on a single technique from Michael Feathers' Working Effectively with Legacy Code.
This is a collection of competent level katas.
They were created together with Roland Germ and we used them in a public Coding Dojo in Vienna.
No comments:
Post a Comment