- Paperback: 239 pages
- Publisher: Pragmatic Bookshelf; 2 edition (September 9, 2007)
- Language: English
- ISBN-10: 0977616673
- ISBN-13: 978-0977616671
- Product Dimensions: 7.5 x 0.7 x 9 inches
- Shipping Weight: 11.2 ounces
- Average Customer Review: 8 customer reviews
- Amazon Best Sellers Rank: #1,667,933 in Books (See Top 100 in Books)
Enter your mobile number or email address below and we'll send you a link to download the free Kindle App. Then you can start reading Kindle books on your smartphone, tablet, or computer - no Kindle device required.
To get the free app, enter your mobile phone number.
Pragmatic Unit Testing in C# with NUnit, 2nd Edition (Pragmatic Starter Kit Series, Vol. 2) 2nd Edition
Use the Amazon App to scan ISBNs and compare prices.
The Amazon Book Review
Author interviews, book reviews, editors picks, and more. Read it now
Customers who bought this item also bought
What other items do customers buy after viewing this item?
"Using the approaches described by Dave and Andy you can reduce greatly the number of defects you put into your code. The result will be faster development of better programs. Try these techniques"
"Andy and Dave have created an excellent, practical and (of course) very pragmatic guide to unit-testing, illustrated with plenty of examples using the latest version of NUnit."
"The Pragmatic Programmers have done it again with this highly useful guide. Aimed directly at C# programmers using the most popular unit-testing package for the language, it goes beyond the basics to show what you should test and how you should test it. Recommended for all .NET developers."
About the Author
Andy Hunt is a programmer turned consultant, author and publisher. He co-authored the best-selling book “The Pragmatic Programmer”, was one of the 17 founders of the Agile Alliance, and co-founded the Pragmatic Bookshelf, publishing award-winning and critically acclaimed books for software developers.
Dave Thomas, as one of the authors of the Agile Manifesto, understands agility. As the author of "Programming Ruby," he understands Ruby. And, as an active Rails developer, he knows Rails.
Top customer reviews
Unfortunately, this book isn't good as a stand-alone. I'll admit that it did help me get started, but it lacks so much that I can't give it more stars. A second volume that covers more advanced topics is suggested, or the next edition can add the missing parts.
Their UI testing chapter was limited to a discussion of various tools that allow you to test-run the actual GUI, but was bereft of patterns like MVP/MVC that exist for the purpose of UI testing.
IoC was virtually if not literally unmentioned.
The mocking chapter was very very light, and mentioned Rhino only in one of those side boxes, not as actual content in the book (!!)
This is one of those books that will give beginners a false sense that unit testing is easy, who then wind up making a mess in a real-world project.
And as noted by other reviewers, the book was written in insufferably chatty prose, which somehow only added up to 190 pages
I'm just starting the Osherove, and it seems outstanding so far.
The first passage that discusses actual test coding (~20 pages or so into the book) presents a simple case where a method should accept an integer array as a parameter and return the largest element. The book then explains how this function, if it behaves properly, should perform. A series of simple test cases are discussed before we get to the real toughie for all you computer scientists out there - a data set consisting of negative integers. A test vector consisting of the array [-9,-8,-7] is passed to the method and -7 is returned. The book explains 'It might look odd, but indeed -7 is larger than -9. We're glad we straightened that out now, rather than in the debugger or in production code where it might not be so obvious.'
ARE YOU KIDDING ME?!? Just what audience was this thing written for? One would have thought that that little gem wouldn't have been necessary... but in fact that is the tone of the entire book. Expect to have your hand held in this manner throughout. If that's the sort of thing that appeals to you, you'll love this one. If, on the other hand, you're trying to learn to incorporate NUnit testing into C# development in an efficient, professional manner, save your money and time and read the NUnit docs.
The real strength of this book is not the author's approach to writing unit tests, but rather they clearly illustrate what exactly should be tested in a unit test. The authors show how adhering to the guidelines they set forth results in unit tests that are well-written and fail at appropriate times. The authors then generalize this to some extent and provide an excellent discussion on the properties of a good unit test.
My favorite section of the book was actually one of the appendices. In the first appendix, the authors go through a list of gotchas--both in writing unit tests in general and specific to unit tests in C#. This is a very short discussion (only 6 pages), but they identify some issues I've seen with poorly written unit tests.
This is a great book as an introduction to writing unit tests. The authors clearly explain why unit tests should be written, they show clearly what should be tested in a unit test, and they describe some of the problems that have been avoided by writing intelligent unit tests.