Saturday, December 1, 2012

Unit testing guru: Roy Osherove

Sure, I learnt how to write unit tests in university. Writing tests to check if te result of adding two integers is actually the sum of the two. However, it took me some work experience to realize the powerfullness of unit testing. When trying to make my offshore team see how they could benefit from testing their code, my collegue found this website: the art of unit testing by Roy Osherove. He's the author of the book with the same name, which is on my to-read list. Roy is described on his blog as:
Roy Osherove is the chief scientist at, and the author of The Art Of Unit Testing and Notes to a software team leader. He is also one of the original ALT.NET organizers. He consults and trains teams worldwide on the gentle art of unit testing, test-driven development and how to lead software teams. He frequently speaks at international conferences on these topics and others.
He's got hours of instruction video's and video's of his talks on his website. I see the most recent ones are talks he did on mock objects. What I find particularly interesting are his pair programming sessions - here. For instance this one:
Some of the lessons I learned from Roy:

  1. The first thing I noticed is how much attention he pays to naming methods, variables, parameters etc. etc. He is very perfectionistic about it. But I think it is because he forces himself ( and the guy he's working with ) to find the essence, the concept of the thing he is working on. 
  2. Not only make sure your code is very well readable ( maintainability ), but also make sure your tests are very intuitive and readable for the other teammembers. 
  3. ReSharper is your friend. He is a test-driven development guru and you can see him writing tests first and then take advantage of ReSharper to generate all the stuff that is not there yet. 

There is probably a lot more lessons I'll learn once I get through his hours of video's and his book. Anyway - check him out if you want to learn about Unit testing and TDD.

No comments:

Post a Comment