Advanced Search
Start Your Free Trial

Overview

Other Readers Also Read...
NHibernate in Action

NHibernate in Action
by Pierre Henri Kuaté; Christian Bauer; Gavin King; Tobin Harris

Agile Principles, Patterns, and Practices in C#

Agile Principles, Patterns, and Practices in C#
by Martin C. Robert; Martin Micah

Top Sellers in this Category

Unit testing, done right, can mean the diff erence between a failed project and a successful one, between a maintainable code base and a code base that no one dares touch, and between getting home at 2 AM or getting home in time for dinner, even before a release deadline.

The Art of Unit Testing builds on top of what's already been written about this important topic. It guides you step by step from simple tests to tests that are maintainable, readable, and trustworthy. It covers advanced subjects like mocks, stubs, and frameworks such as Typemock Isolator and Rhino Mocks. And you'll learn about advanced test patterns and organization, working with legacy code and even untestable code. The book discusses tools you need when testing databases and other technologies. It's written for .NET developers but others will also benefit from this book.

WHAT'S INSIDE THE BOOK:

  • How to create readable, maintainable, trustworthy tests

  • Stubs, mock objects, and automated frameworks

  • Working with .NET tools, including NUnit, Rhino Mocks and Typemock Isolator

Amazon.com® Reader Reviews (Ranked by Helpfulness)

Average Amazon.com® Rating: 5.0 out of 5 rating Based on 12 Ratings

Thought-provoking, change-inducing coverage of unit testing - 2009-11-02
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
First off, I've been doing unit testing for a while now. Very basic testing, at that. My existing tests, before I read this book, were rather hack-and-slash, with no serious organization, naming, or coding standards. They really only covered the low-hanging fruit of the code under test, and didn't cover any code that had dependencies. With the stage set, on to the book.

I won't discuss every chapter of the book, as that has been done already. I will comment on specific ones of value to me.

Chapters 3 and 4 were very educational for me, as they covered stubs and mocks, a subject I was unfamiliar with previously. Now that I know what they are and when, where, and how to use them, I will be able to simplify my unit tests.

Chapter 7, about the pillars of unit tests, is worth the cost of the book. It emphasizes the importance of the trustworthiness, readability, and maintainability of your test code.

There are two appendices, one on designing code for testability, and one listing various tools and frameworks to assist the unit testing process. These are good to have at hand.

Now going back to where I started this review: after having read this book, I can see ways that my test code can be improved. I've already started naming my test cases in a standard manner, and organizing test classes so they parallel the code under test. I have started using dependency injection to enable testability, and my code coverage has risen as a result. I will be reviewing my tests for the qualities, or lack thereof, mentioned in the chapter about pillars of unit tests.

As an aside, I would like to recommend an additional book: Working Effectively with Legacy Code, by Michael Feathers. Not to take away from this one, but the legacy code book is a fine choice to pair with this one. They are very complementary; Art of Unit Testing is about getting your code under test, while Working Effectively with Legacy Code is about refactoring your code to make it testable. Roy actually mentions the legacy code book in passing, and recommends it.

If you are not already a guru on unit testing, and are looking to improve your knowledge on the subject, this book is for you. I recommend it.

Great, Practical Guidance For Unit Testing - 2009-10-19
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
So, I ordered this book along with a few others when my team was about to start writing unit tests. Of all the books I ordered, this one was the most packed with realistic, hands-on guidance on how to organize your tests, and wide-ranging best practices and test patterns for how to write tests that are easy to maintain.

Roy Osherove has a lot of experience helping companies with "the art" of unit testing. He believes the key to successful unit testing rests on three pillars: maintainability, readability, and trustworthiness. He explains in the book what those things actually look like in real-world examples and why you might not be getting everything you could be out of your tests if you overlook one of those.

Roy also includes a fairly detailed comparison of the latest tools and frameworks you have to choose from. This section alone could save a ton of research time by getting a fairly unbiased, expert's view of the pros and cons for these types of tools and frameworks:
- Test Frameworks: NUnit, MSTest, MbUnit, Gallio, xUnit, Pex
- Isolation Frameworks: Moq, Rhino Mocks, Typemock Isolator, NMock, NUnit.Mocks
- IoC Containers: StructureMap, Unity, Castle Windsor, Autofac, Common Service Locator (CSL), Spring.NET, Managed Extensibility Framework (MEF), Ninject
- Web Testing: Ivonna, VS Team System Web Test, NUnitAsp, Watir, WatiN, Selenium
- UI Testing: NUnitForms, Project White, Team System UI Tests
- Thread-Related Testing: Typemock Racer, Microsoft CHESS
- Acceptance Testing: FitNesse, StoryTeller

This book was a short 320 pages, but there is a ton of practical and applicable tips jammed between the covers. But, I have to mention that this book isn't as polished as you would probably expect with most published works. It isn't anything major, but just a few things in the text or code samples that should have been caught by testers or an editor. These issues don't really take away from the content, but it just wasn't up to the standard I expect when buying a published work. (And that is possibly the worst cover I have ever seen ... yes, I get the reference to "The Art of War").

If you are remotely interested in this topic, you should listen to a recent podcast Roy did with Scott Hanselman on "The Art of Unit Testing." Although the podcast is kind of like a cliff-notes version of the book ... it isn't a replacement. If you find the podcast remotely helpful, order the book.

To read the full review or view more technical book reviews like this, visit [...].

Great Book on Unit Testing with .NET - 2009-10-07
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
I have been a .NET developer for over 6 years now and honestly have not had a real need for unit testing until recently. My current job and dept are slowing forcing all their developers to write up unit-testing proceedures for all of the application they have developed and I thought getting this book would be a very good idea.

This book covers unit testing in .NET from a pragmatic, yet thourough and passionate, perspective. It covers organizational topics such as how you introduce unit testing in an organization and how to do code reviews of tests.

The book begins with an introduction to NUnit, and a set of definitions. It then moves quickly enough to a bit of practice with a first unit test.

The next section develops the concept of mock and stubs, and discusses in depth the Rhino Mocks framework. This part furthermore presents a set of good practices related to the use of this Framework, or any other isolation framework.

After discussing the building blocks of unit tests, the third part presents a set of good practice for the tests themselves, to avoid (among other issues) that the maintenance cost of the tests exceeds the advantage gained by their existence.

The last part of the book is looking at a level above, and presents the different points to keep in mind when introducing unit tests in an organization and especially in an existing project, which can represent a large proportion of cases when introducing unit testing in a team or project.

If you are new to unit testing like me, this book will demystify the practices, tools and techniques that would otherwise take years and lots of frustration to get right.

A great buy and must read for any UNIT testers!

The Best - 2009-09-30
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
I would agree with most of the other reviews here. Roy's book is simply one of the best books ever written on unit testing. I would highly recommend this book to every developer.

Here are a few points that really sum up why this book stands out as the best...

*No Fluff - It's a slimmer book (320 pages), but packed with information. The size of the book makes it very approachable, and it's one of those books that you may want to read a few times to make sure everything really sinks in. It's a book you can recommend to just about everyone, regardless of their background.

*No Preaching - One key thing that sets this book in a class by itself is the fact that it doesn't focus on specific methodologies (like TDD), but is simply a guide to unit testing. The book doesn't assume anything or force any one way of practicing the art. Fully devoted to TDD, great. Could care less about TDD? This book is for you as well.

*Independent - Despite the fact that Roy works for Typemock, the majority of examples found in the book use open-source "mocking" or isolation frameworks. Throughout the book, no one tool is pushed over another. Roy does a good job of going over the pros and cons of many different tools, from many vendors.

*Inspiring - From the initial chapter on, this book not only educates, but it truly inspires. This is one of those books that gets you ramped up to do something. Whether it is starting unit testing within your organization, or enhancing existing tests, you'll want to start right away. It's that feeling we geeks get when a new version of software is released. I know I'm not the only one who goes to software conferences and such, and feels like jumping head first into the latest and greatest.

[...]

Changed my Thinking about Unit Testing - 2009-09-25
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
This book was a huge breakthrough for me as far as understanding the type of testing that goes on in our organization, integration testing, not unit testing! Before I read Roy's book I thought that I was looking for evidence on Test Driven Development but I found out that the real prize I was interested in was automated unit testing. Our large organization needs to evolve to better testing methods and I have integrated many of the concepts from this book into my recommendations to management. I recently developed a presentation for a developer's user group meeting that focused on unit testing with material from this book featured prominently. The book was very easy to understand and well written.

Browse Similar Topics

Top Level Categories:
Internet/Online

Sub-Categories:
Internet/Online > .Net

Some information on this page was provided using data from Amazon.com®. View at Amazon >


About Safari Books Online • Terms of Service • Privacy Policy • Contact Us • Corporate Licenses • Help • Accessibility | See us on FacebookSee us on Linked InSee us on TwitterRSS

Copyright 2009 Safari Books Online. All rights reserved.