Home > Coding, Training > No Time to Unit Test
Print This Post Print This Post

No Time to Unit Test

While reading Scott Bain’s great book Emergent Design, I was reminded of a story. It took place a couple of years ago inside a very tall building in a very large city. I was giving an early version of my Test Driven Development workshop. There were about 25 developers to entertain. I asked the standard calibration questions:

-    How many of you are doing TDD now? Answer: none
-    How many of you do unit testing? Answer: none
-    How many of you know what unit testing is? Answer: some
-    Of those of you who know what it is, do you think it is a good idea? Answer: yes
-    Why, then, do you not do it? Answer: we don’t have time

It was not an unusual set of answers, of course. I have had that same dialog with more than one group.

I went through my presentation and covered a lot of ground. Just before lunch I talked about code coverage and gave a demonstration using the whimsically named Eclipse plug-in Coverlipse. One of the participants was particularly interested by the concept, the fellow who had stated that no one had time for unit testing. He had accepted my invitation to bring work to the class in order to try out TDD on something familiar rather than doing the exercises I provided. He wanted to try code coverage and asked to use my machine during lunch because we could not get a network connection in the room for him to download Coverlipse.

At the end of the lunch break, I asked if he would share his discoveries with the class. He had been working for about 20 minutes. His code was a caching system for high volume transactions. He had written some unit tests, driven by a desire to maximize code coverage. I explained to the class that this was one approach, not a test-first approach but a valid one once you have a design you are happy with.

As the class reassembled, he was at 60% code coverage. I let him work out loud, projecting on the screen, sharing his strategy. At one point he made a design change based on test results which I pointed out to the class. After about 30 minutes he achieved 87% code coverage. He was very happy. The class was impressed. As he returned to his seat, I began the afternoon session with a reinforcing question:

“Now, what were you saying about not having time to do unit testing? How long did it take you to get to 87% code coverage?”

Bookmark and Share
Categories: Coding, Training Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

monster headphones louis vuitton handbags north face womens tory burch sale tory burch bags north face mens louis vuitton monogram monster cables babyliss hair air max 2011 hollister clothing nike dunk sb new toms ecco footwear adidas shoes monster beats sale monster beats online monster beats outlet monster beats sale monster headphones monster beats headphones monster headphones sale monster beats online monster beats online monster beats cheap monster beats outlet sale karen millen karen millen outlet karen millen sale karen millen sale karen millen uk karen millen ireland karen millen sale karen millen denmark karen millen online sale karen millen timberland outlet timberland online timberland uk timberland online timberland shoes timberland online timberland online timberland online timberland online timberland online timberland online karen millen outlet michael kors outlet roger vivier online ferragamo outlet moncler online outlet belstaff moncler online north face jacket karen millen uk timberland sale hogan shoes online timberland sale karen millen online timberland sale abercrombie sale moncler sale north face sale moncler sale moncler online shop doudoune moncler homme belstaff sale belstaff sale belstaff jackets north face outlet radii straight jacket north face sale doudoune moncler north face jackets belstaff sale abercrombie fitch sale abercrombie and fitch karen millen dress north face jacket coach Purses Coach Outlet Store coach factory outlet Coach Factory Outlet coach outlet Coach Outlet Coach Outlet Online Coach Outlet Store Coach Outlet Canada Coach Outlet Coach Outlet Store coach wallets coach outlet coach sale Ferragamo Sale north face north face north face outlet coach outlet coach outlet north face sale north face sale