Follow @RoyOsherove on Twitter

What's new and Changed in the Art of Unit Testing 2nd Edition

I still get called out for some things I wrote in the first edition published in 2009. Some people might not be aware there is a 2nd edition out there, or are borrowing old copies. Lots has changed in my thinking about unit testing practices since then and was reflected when the 2nd edition was published in 2013.
In this second edition, I added:
  • Material about constrained versus unconstrained isolation frameworks : specifically those that can fake things like statics and priavte methods.
  • A new chapter 6 on what makes for a good isolation framework and how frameworks like Typemock work under the covers. 
  • I no longer use RhinoMocks. Stay away from it. It is dead. At least for now. I use NSubstitute for examples of Isolation Framework Basics, and I also highly recommend FakeItEasy. I am still not crazy about MOQ, for reasons detailed in chapter 6.
  • I added more techniques to the chapter about implementing unit testing at the organizational level, such as understanding influence factors
  • There are plenty of design changes in the code I show in the book:
  • Mostly I stopped using property setters and am mostly using constructor injection. 
  • Some discussion of SOLID principles is added, but just enough to make it whet your appetite on the subject.
  • The build related sections of chapter 7 also contain new information. I learned a lot since the first book about build automation and patterns. It’s the topic of my next book. In this book I talk about build pipelines and where unit testing fits in the process.
  • I recommend against setup methods, and give alternative ideas on getting the same functionality out of your tests. 
  • I also use newer versions of Nunit so some of the newer Nunit APIs changed in the book( Assert.thorws. vs Assert.Catch, TestCase attributes and more)
  • In chapter 10, the tools relating to legacy code were updated.
  • Having worked with Ruby for the past three years along side .NET, I gained more perspective about design and testability arguments, reflected in chapter 11, dedicated only to this topic.
  • The tools and frameworks appendix was updated with new tools, and old tools were removed.

Also, here is a talk I did about it:

 

Two new Online Courses: Effective Total Command and FinalBuilder Training Videos

Why The Hell did you move to New Jersey, Roy?