TDD - A Poem
Test Driven, Test Driven...
Test First, Feature Driven...
Our right to test is not employer given
We choose to test; our right; our decision; it's called professionalism
Write a test, before you progress
Watch it fail, we will prevail
Write the code, make it pass fast
Don't worry, we'll clean it last
Run it baby run it, does it go green?
Ugh, they're taking to long to run, I'm gonna scream!
It's taking too long? too long!!!!????
Your code is not isolated; your tests are written wrong!
Still red you say? ok, don't run away
It's just a bug that we haven't seen
You're almost there, don't turn to dispair
Fix it, run all tests, now are they green?
Oh Green, Green! Yes! Yes!
I'm done! I'm done! wait happy one...you're moving too fast
Fast you say? Yes, take a chill, you gotta refactor still
Refactor you say? Yes blue, both prod & test code right away
But I need to move fast, got a deadline that'll pass
But you're not doing TDD, if you skip the blue you see...
When you skip blue, you make a mess
When you make a mess the less you progress
Refactor now, to keep your code lean
Refactor now, to keep your code clean
Refactor now, and use your talents to design
Refactor now, because your next test will mind
They cycle is done, what to write next?
Next test smallest step, to force you to progress
Progress you say? Yes, lets to write a little more code
Our best guess, the next behavior to test
Triangulate, to force your code to bend
Red, then green, then refactor again
Last test is finished, now we are done!
Wow, I gotta tell you this sure is fun!
Run all tests, if green check them in
Tomorrow a new feature, a new test we'll begin
I know..pretty lame, but had fun writing it, I don't care
About the Author:
Dave Schinkel runs WeDoTDD.com a site dedicated to finding an listing teams who practice Test Driven development. He is a TDD practitioner who is also a mentor on CodeMentor.io. Book a session now with Dave and learn some unit testing!