Last night I had the opportunity to do my 'Taking your tests to the next level with Mocks' session to the TriNug user group. I would first like to say thanks to Doug Wilson and his entire group. They had a great turn out (45ish people) and they asked a ton of great questions.
To kick off the session I ask the same question I ask everything I give this session 'Who in here writes tests as part of their development routine?'. The response I got did not surprise me, about 30% said they did. I then asked those 30%, who using a mocking framework? Again the response did not surprise me, only about 50%.
Of course with only 30% even saying they test, I had to ask why, why and why. The responses I got I have heard before and thought I would share them
- It is too hard to get started
I have heard this one before, and I am not going to lie to you, writing tests is hard, it takes effort and time to learn how to do it. But just ask yourself this. When learning anything new is it easy? Are you able to just pickup a new tool/technology and 'know it' or do you have to learn it? My guess you have to learn it, testing/mocking is no different.
- My client/company is not paying me to write tests
Sorry, but this is one statement have to call BS on. I immediately asked, is your company paying you to write shitty quality? Or are they paying you to produce quality code? If they are paying you to write shitty code, STOP reading now as I am done talking to you (ok, may be not, but really??? shitty code is what they want???). If they are paying you to create quality code how can you insure it without tests? My guess is that you have tests, but they just happen to be of the manual, error prone nature.
- I do not have time
Again, another one I call BS on. I followed this up with 'let me guess, you have time to debug/bug hunt at the end right?'. The key to testing is that it does take time (wow, that is honest) but it is either a pay me now, or pay me later scenario. Either you take the time now to embed quality or you take the time later to duck-tap quality. Your choice?
With this information in hand, I really attempted to drive home the values of both testing as well as using a mocking framework to remove dependencies. I think towards the end of the night I had converted some people to 'believers' and hopefully they will either give testing a solid go (assuming they are not testing right now) or give using a mocking framework a go.
You can get any of my session information from Google code from this location http://code.google.com/p/graudo/.
Till next time,
[----- Remember to check out DimeCasts.Net -----]
11-13-2008 6:36 AM