The TDD game
that you never played
Lior Israel
http://blogs.microsoft.co.il/lior_israel/
https://www.linkedin.com/in/liorisrael
Who are
you ?
Who are you really?
Developer
Traveler
Product
experts
Manager
Scrum
master
QA
Who
am I ?
Who
am I ?
Hardware
developer
Developer
Chief
Architect
“Chef”
Geek of
Code
Blogger
Husband
&
Father
Workshop guideline
We are going to use
interactions ,
Working software,
participants
collaboration and
Responding to
change
First open your
mind
This is not only
for a developers
– this is for ALL
players in the
AGILE game
We will run 2-3
katas – we can
play andor you
can watch
Any case try to
enjoy
It’s all about
A short
feedback loop
TDD as a way of working
• TDD is not a UNIT TEST
• TDD is part of the Software craftsmanship
• TDD must be adjusted to US/DoD and not to
Implementation
• If someone can understand your test
You are on the right way
• If the BA can understand your test
You are in a perfect way
TDD – Test Driven Design
Design High Level system
Build the contracts
"Fake it 'til you make it“ – make it clear
The system must be green
Now we can implement it
The first kata
• As an interviewer
• I want that the candidate to write
a code that will replace the two
variables (INT)
• So I can figure out whether he is
the right person for the job
The FizzBuzz kata
FizzBuzz code KATA
• 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"
Here are the new requirements
• A number is fizz if it is divisible by 3
or if it has a 3 in it
• A number is buzz if it is divisible by 5
or if it has a 5 in it
The Potter kata
http://www.codingdojo.org/cgi-bin/index.pl?KataPotter
Problem Description
• For example, how much does this basket of
books cost?
– 2 copies of the first book
– 2 copies of the second book
– 2 copies of the third book
– 1 copy of the fourth book
– 1 copy of the fifth book
– 2* (8*4*0.8) ,answer: 51.20 EUR
Few tests for a starting
def testSeveralDiscounts
assert_equal(8 + (8 * 2 * 0.95), price([0, 0, 1]))
assert_equal(2 * (8 * 2 * 0.95), price([0, 0, 1, 1]))
assert_equal((8 * 4 * 0.8) + (8 * 2 * 0.95), price([0, 0, 1, 2, 2, 3]))
assert_equal(8 + (8 * 5 * 0.75), price([0, 1, 1, 2, 3, 4]))
end
def testEdgeCases
assert_equal(2 * (8 * 4 * 0.8), price([0, 0, 1, 1, 2, 2, 3, 4]))
assert_equal(3 * (8 * 5 * 0.75) + 2 * (8 * 4 * 0.8),
price([0, 0, 0, 0, 0,
1, 1, 1, 1, 1,
2, 2, 2, 2,
3, 3, 3, 3, 3,
4, 4, 4, 4]))
end
Thank
you :-9
I'm
available
for
Questions
Any time,
any place,
anywhere

The TDD game that you never played

  • 1.
    The TDD game thatyou never played Lior Israel http://blogs.microsoft.co.il/lior_israel/ https://www.linkedin.com/in/liorisrael
  • 2.
  • 3.
    Who are youreally? Developer Traveler Product experts Manager Scrum master QA
  • 4.
  • 5.
  • 6.
    Workshop guideline We aregoing to use interactions , Working software, participants collaboration and Responding to change First open your mind This is not only for a developers – this is for ALL players in the AGILE game We will run 2-3 katas – we can play andor you can watch Any case try to enjoy
  • 7.
    It’s all about Ashort feedback loop
  • 8.
    TDD as away of working • TDD is not a UNIT TEST • TDD is part of the Software craftsmanship • TDD must be adjusted to US/DoD and not to Implementation • If someone can understand your test You are on the right way • If the BA can understand your test You are in a perfect way
  • 9.
    TDD – TestDriven Design Design High Level system Build the contracts "Fake it 'til you make it“ – make it clear The system must be green Now we can implement it
  • 10.
  • 11.
    • As aninterviewer • I want that the candidate to write a code that will replace the two variables (INT) • So I can figure out whether he is the right person for the job
  • 12.
  • 13.
    FizzBuzz code KATA •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"
  • 14.
    Here are thenew requirements • A number is fizz if it is divisible by 3 or if it has a 3 in it • A number is buzz if it is divisible by 5 or if it has a 5 in it
  • 15.
  • 16.
    Problem Description • Forexample, how much does this basket of books cost? – 2 copies of the first book – 2 copies of the second book – 2 copies of the third book – 1 copy of the fourth book – 1 copy of the fifth book – 2* (8*4*0.8) ,answer: 51.20 EUR
  • 17.
    Few tests fora starting def testSeveralDiscounts assert_equal(8 + (8 * 2 * 0.95), price([0, 0, 1])) assert_equal(2 * (8 * 2 * 0.95), price([0, 0, 1, 1])) assert_equal((8 * 4 * 0.8) + (8 * 2 * 0.95), price([0, 0, 1, 2, 2, 3])) assert_equal(8 + (8 * 5 * 0.75), price([0, 1, 1, 2, 3, 4])) end def testEdgeCases assert_equal(2 * (8 * 4 * 0.8), price([0, 0, 1, 1, 2, 2, 3, 4])) assert_equal(3 * (8 * 5 * 0.75) + 2 * (8 * 4 * 0.8), price([0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4])) end
  • 18.

Editor's Notes