ailon's DevBlog: Development related stuff in my life

Book Review: The Art of Unit Testing by Roy Osherove

2/2/2010 7:49:36 PM

The Art of Unit Testing by Roy Osherove

Personal preface

I must admit – I haven’t been doing any real-life unit testing until now. Back in 2004 I was leading a relatively big WinForms project and I thought we should do unit testing on it. Unfortunately we had already finalized our conceptual designs (which didn’t consider unit testing), the tooling at the time wasn’t as mature as it is now and, most importantly, we had no knowledge on how this unit testing thing should be done properly. So after playing around with NUnit for some time I’ve concluded that it was neither the time nor the place to start doing it for real and put it away.

After that project I was mostly involved with smaller ASP.NET projects and never thought that unit testing was really feasible for them. So, basically unit testing was always somewhere on my mind but not too close to the surface.

Five years later I’ve started working on amCharts for WPF & Silverlight and as we release new products, add new features and fix bugs I’ve started feeling a real fear of breaking something while fixing a bug or adding a new feature. Manual testing helps but the fear is always there. I understood that it’s time for “take 2” on unit testing.

This time I knew that I have to do it right. This is one of those subjects where you can’t just start doing it and learn as you go. That is a sure way to fail (see my experience above).

The Book

Fortunately this time there is this book and it’s targeted at .NET developers which is not essential but a nice bonus. I’ve been reading Roy Osherove’s blog for quite some time and following him on twitter. I’ve been using his Regulator regular expression testing tool before that. So, I sort of “knew” and respected the author, the book got raving reviews at Amazon – buying it was a no-brainer.

The book is short (less than 300 pages) but on point with almost none “water spilled” and space wasted. I’ve swallowed it in less than a week reading it in the evenings only. That wouldn’t be that fast for a fiction book, but I think that’s a record for me for a technical book. I usually fall asleep reading technical books in bed pretty quickly and I only did it once with this book ;)

It covers all the aspects of unit testing, writing good tests and testable code, tooling for .NET (also mentions tools for Java, C++, etc.). It also offers quite strong author’s opinions on the matters. Some people might not like this, but as long as you can see that it’s an opinion and not something written in stone, I really do like it.

Minor Criticism

I can’t say anything bad about the content of this book, but I have a few minor complaints about presentation. First of all I didn’t like the font used. I’m no expert of fonts and this could be the default Manning (publisher) font, but it didn’t feel right to me (too wide or something). The use of some “comic” type of font for ToC and headings is another story, but since it’s not the main font it didn’t bother me much. There were some minor issues with sample code too: incorrect indentation, a couple of auto-capitalized “return” statements and things like that, but nothing major.

The book comes with free access to ebook version in PDF, ePub and Mobipocket formats w/o DRM (as far as I understand). Unpleasant thing was that my name and email address was inserted in the footer of every page of the PDF. I don’t even know what is more unpleasant DRM or this. Should I protect the PDF now so it doesn’t spread over internet accidentally or something? If I wanted to spread illegal copies I’d find a way to remove this, but now I don’t even feel comfortable giving that PDF to my colleague which I consider a fair use (I’ll give him a paper book anyway). Anyway this is a minor issue and I should stop complaining.

Conclusion

If you are serious about starting unit testing or improving your skills, do yourself a favor and don’t just jump right in, but buy this book (especially if your main platform is .NET). It’s a really excellent starting point for anyone who doesn’t consider himself a unit testing guru (and I guess even gurus might find something new). After reading this book I feel pretty confident that my next project will include unit tests and I’ll have a good basis and this book as a reference if I have questions.

Links

Tags: , ,

Comments

2/3/2010 5:08:47 PM

Samuel Jack

I read this book a few months back and I was a little put off by the presentation - it makes the book look rather unprofessional. I also felt that the book could have done with more extensive editing. There were parts of it that read just like extended blog posts.

Samuel Jack United Kingdom

2/4/2010 10:22:30 AM

ailon

I guess nowadays you can't really complain about lack of editing in any specific technical book. It's unpleasant trend in all of them and most likely is the result of tight budgets and schedules.

ailon Lithuania

4/14/2010 8:41:37 AM

David

Thanks for the tip about the book. Ill be sure to check it out. After Samuel's post Im a bit more skeptical but maybe I can pick it up for cheap and learn a few things.

David United States

4/15/2010 11:47:30 AM

Roger

Thanks for this revue. This book should have been a little bit more thought. I mean there are many errors.

Roger France

5/4/2010 2:48:46 PM

Ian

I remember one quote by somone "unit testing is something everybody talks about, but nobody does". I used to be a project manager in IT and you would be amazed if you knew how many developers are out there who know absolutely nothing about unit-testing.

Ian Estonia

6/7/2010 6:56:07 AM

jason wenrich

this really is an excellent book. when i first started developing in .net, I had big problems with unit-testing (maybe it was just me). This was a valuable resource and I recommend it!

jason wenrich United States

7/5/2010 8:31:58 PM

La Martina

Was there any talk of junit in the book?

La Martina United States

7/9/2010 3:54:29 PM

Naz

Hi Alan. To be honest, one of my friend mentioning me that this book not that good because it doesn't cover as many details. I don't know whether it's true or not. I want to buy a give for my cousin that's why I'm searching something like this one and.. I found your blog through Google. Thanks for your review, anyway. Appreciate it.  =)

Naz Malaysia

7/9/2010 4:57:17 PM

Nanny Cam

I myself am a .NET developer and i found this book very insightful. I agree with one previous poster that some chapters seem like longer blog posts, but that doesnt really bother me, because it delivers the information. I would have added a few extra chapters on some stuff but maybe that will be part 2 of the book Smile

Nanny Cam Slovenia

7/11/2010 5:52:35 PM

tim frankfurt

Thanks for your book review! i will definetly get the book before i start unit testing on .NET platform. greets from germany

tim frankfurt Germany

7/12/2010 1:11:42 PM

Dan Seinard

Thanks for the review. I'm going to pick this up soon!

Dan Seinard United States

7/20/2010 9:39:47 AM

Le Quy Loc

Thanks for your effort to make the good review. I will try to invest some money to buy the book. I am myself also a .NET programmer for 3 years.

Le Quy Loc United States

7/23/2010 12:55:01 AM

James Fraser

Lack of editing is definitely frustrating...

James Fraser United Kingdom

8/11/2010 7:25:59 PM

Richard Smith

I have worked extensively with the .NET platform over the last few years and read this book about six months ago.  I wasn't overly impressed, and I didn't feel that the book did a good enough job of explaining some of the more complex topics.  That being said, it did provide good basics for a lot of people who are new to .NET

Richard Smith United States

8/13/2010 4:10:03 AM

Jim Thomas

I'll definitely have a look at this book.  I'm a .NET programmer just getting into unit testing and I've been looking for a guide.  Glad you found this.

Jim Thomas United States

8/23/2010 2:15:10 PM

Tom

WOw this book seems to be amazing. I will go to my local bookstore today and tell you all how i liked it!

Tom Germany

8/29/2010 4:38:14 PM

antoine helbert

looks like we got a winner here , thanks for nice review

antoine helbert Greece

8/30/2010 2:52:06 AM

Natalie Markins

IMO, The book is very good for beginners, but not for those who already practise TDD on a daily basis. If Roy wrote another book, I will certainly buy it with the hope that it will be as excellent as this.

Natalie Markins Netherlands

8/30/2010 6:53:30 AM

Mack

this was an alright read, and like you I found the font used in the book was too wide. other then that, good review.

Mack United States

8/31/2010 1:25:34 AM

Mike Walters

I'll have to pick this book up. O'Reilly books have pictures of interesting animals on the cover and Manning Publications books have pictures of interesting people.

Mike Walters United States

9/1/2010 10:53:31 PM

Japanese Tattoo Designs

In my experience with software development, so much money, time and effort can be saved through intelligent testing.

Japanese Tattoo Designs United States

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Copyright © 2003 - 2010 Alan Mendelevich
Powered by BlogEngine.NET 1.6.1.0