Doing Code Katas alone or in a Dojo can help sharpen our elementary skills as software developers. Practicing IDE shortcuts and TDD mini-step cycles is very useful for the daily business, yet I find …
Doing Code Katas alone or in a Dojo can help sharpen our elementary skills as software developers. Practicing IDE shortcuts and TDD mini-step cycles is very useful for the daily business, yet I find some existing Code Katas too far away from real-life programming situations.
That’s why I came up with the Trading Card Game Kata – which is (very loosely) based on Blizzard Entertainment’s free-to-play online-game “Hearthstone – Heroes of Warcraft”. This Kata is focused on practicing TDD in a slightly more complex (but not complicated) situation where you might have to think about rules like Single Responsibility Principle or Command Query Separation and might even feel the urge to use a Mocking framework at some point. The rules are kept very simple to begin with but can be extended easily to make the Kata more challenging or concentrate on specific aspects of software development.
In this talk I will first introduce the ideas of Katas in general and explain the TCG Kata rules to you. Then I will present some real-life best practices for writing good developer tests, using my TCG Kata sample solutions as a showcase. This will include:
* Picking the right Test Double
* Test Data Builders
* Behavior Tests with BDDMockito
* Prose-like Assertions with Hamcrest
* Readability Sugar
* Custom Matchers against Test Diabetes
The full Kata ruleset and sample solutions in Java 8 (JUnit4, Mockito, Hamcrest) and Groovy (Spock) can be found on https://github.com/bkimminich/kata-tcg.
A recording of this talk at „Agile Saturday X“ in Tallinn, Estonia can be found on https://vimeo.com/92886146.