Beginning TDD
Het Patel Zan Markan Chris Patuzzo
@hetal_patel @zmarkan @cpatuzzo
Objectives
Gain an understanding of common test-driven development practices and methodologies
Feel confident in trying out TDD with other Katas
The objective isn't to complete the exercise
Agenda
1) TDD Walkthrough
2) Pair up and work on the exercise
3) Retrospective
TDD Walkthrough
Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.
Red, Green, Refactor
Test Frameworks
Most programming languages come with test frameworks.
C# - NUnit, MSTEST
Java - JUnit
Ruby - Test::Unit, RSpec
These allow you to make assertions about your code.
The Exercise
https://github.com/zmarkan/StringCalculatorKata
This repository contains a C#, Java and Ruby template. Choose your favourite weapon!
The requirements are in the README.
The Rules
Work in pairs - someone you've never met
Ping pong:
1) One person writes a test
2) The other person implements
3) Refactor together
4) Swap roles && GOTO 1
Things to think about
How did you find ping pong? What did you find difficult about it?
How did you find red, green refactor? Which part did you spend the longest on?
Would you try TDD at work? What do you think are the biggest obstacles in real life scenarios?
Closing Remarks
TDD may be slow at first, but with a little practice it'll get much quicker.
Practice, practice, practice.
Be imaginative - come up with your own requirements.
If you enjoyed the format of this session, please let us know.
Discussion can continue on the meetup group and mailing list.
See you at the pub!