Husband, Father and VP of Engineering at Emmersion, Founder Software Craftsmanship Atlanta
Oct. 18, 2016•0 likes•959 views
1 of 39
Put the Tests Before the Code
Oct. 18, 2016•0 likes•959 views
Download to read offline
Report
Software
Test Driven Development specifies that you write a failing unit test before you write any code. Some people say this is impossible. I'll demonstrate that it's not only possible, but will change how you write code for the better.
1. Put the Tests before the
Code: Coding the Right Way
Mike Clement
@mdclement
mike@softwareontheside.com
http://blog.softwareontheside.com
http://agilecodegames.com
2. REQUIREMENTS
You will need these files(Windows) to complete the assignment. Details for method constraints are found in these
documents and are still a part of the requirements. (If you downloaded the test driver documents before 8/30
12:00pm you will need to re-download them. An error was fixed.)
Part 1 - Construct the Arena (5 points)
Extend the ArenaInterface provided; the arena is simply a collection of fighters, each with a unique name
For Part 1 only, you may assume all strings passed to the arena's adding method will be of the correct format
For Part 1 only, you may assume all strings passed to the arena's getting and removing methods will be names
already existing in the arena
Part 2 - Let the Battle Begin (8 points)
Extend the FighterInterface provided; details about abilities, stats, and more can be found in the FighterInterface
For Part 3, the test driver will not call your useAbility() or regenerate() methods, so it is possible to receive credit for
Part 3 without these methods being complete
Completion of Part 1 is required to submit Part 2
Part 3 - Fortify the Walls (5 points)
Make adding new fighters to your arena bullet-proof
This involves rejecting any string that is not of the correct format or that would add a duplicate name to the arena
Make getting and removing existing fighters in your arena bullet-proof
Completion of Part 1 is required to submit Part 3
Part 4 - Let Me Show You My True Form... (12 points, 4 points per fighter type)
Add functionality to the useAbility() method and the regenerate() method for each fighter type
The isSimplified() method must return false for each fighter type to be tested to alert the test driver that full testing
should occur for that fighter type
Completion of Part 1 is required to submit Part 4
11. When you actually sit
down to write some code,
you learn things that you
didn’t get from thinking
about them in modeling
terms…there is a feedback
process there that you can
only really get at from
executing some things and
seeing what works
- Martin Fowler
20. When you actually sit
down to write some code,
you learn things that you
didn’t get from thinking
about them in modeling
terms…there is a feedback
process there that you can
only really get at from
executing some things and
seeing what works
- Martin Fowler
31. Uncle Bob’s Three Laws of TDD
• You are not allowed to write any production code unless it is to make
a failing unit test pass.
• You are not allowed to write any more of a unit test than is sufficient
to fail; and compilation failures are failures.
• You are not allowed to write any more production code than is
sufficient to pass the one failing unit test.