Thursday, June 7, 2012

How to waste time on TDD

This blog post was originally written by Piotr Włodarek on his TheSingularity.pl blog. I liked it so much that I translated it to English, so that it can reach a broader audience.

 Some people argue that TDD slows down the development process. If you want to follow this opinion here's what you should do:

  1. Write tests after writing the production code.
  2. Waste no time thinking about designing, simply jump straight into the TDD loop and do 100% of the design work there. You'll have a chance to change your code and tests structure over and over again. 
  3. Learn how to write test scenarios completely on your own, don't bother watching any screencasts and don't read any books on the topic. 
  4. Make sure your tests load at least half a minute before they actually start testing anything. You can easily achieve that by loading the whole framework and working with your old crappy HDD. 
  5. Make sure all the features are tested through the GUI (by driving a web browser or desktop GUI window). 
  6. Make sure all your tests depend on the database. 
  7. Manually find the corresponding test file and the production code. 
  8. Navigate between desktops, windows, tabs only to find the tests starting script. 
  9. Try to write as few classes as possible to ensure every class has multiple unrelated responsibilities. These are guaranteed to be a testing nightmare. 
  10. Write beautiful step definitions in Cucumber even if your customer doesn't care about reading your specs (or perhaps you don't even have a customer yet).

3 comments:

Oriol said...

I agree on everything except for #10, and it's related to #2:

Writing Cucumber (or Spinach :P) scenarios can really help abstract what are you trying to do and make you think what is valuable and what not.

And remember that is NOT mandatory to use Capyabra with Cucumber!

michal said...

LOL

jimi said...
This comment has been removed by a blog administrator.