Goodreads helps you keep track of books you want to read.
Start by marking “The Art of Unit Testing: with examples in C#” as Want to Read:
The Art of Unit Testing: with examples in C#
Enlarge cover
Rate this book
Clear rating
Open Preview

The Art of Unit Testing: with examples in C#

4.10  ·  Rating details ·  1,286 ratings  ·  93 reviews

The Art of Unit Testing, Second Edition guides you step by step from writing your first simple tests to developing robust test sets that are maintainable, readable, and trustworthy. You'll master the foundational ideas and quickly move to high-value subjects like mocks, stubs, and isolation, including frameworks such as Moq, FakeItEasy, and Typemock Isolator. You'll
Paperback, Second Edition, 266 pages
Published December 7th 2013 by Manning Publications (first published July 5th 2009)
More Details... Edit Details

Friend Reviews

To see what your friends thought of this book, please sign up.

Reader Q&A

To ask other readers questions about The Art of Unit Testing, please sign up.

Be the first to ask a question about The Art of Unit Testing

This book is not yet featured on Listopia. Add this book to your favorite list »

Community Reviews

Showing 1-30
Average rating 4.10  · 
Rating details
 ·  1,286 ratings  ·  93 reviews

More filters
Sort order
Start your review of The Art of Unit Testing: with examples in C#
Jan 27, 2013 rated it liked it  ·  (Review from the author)  ·  review of another edition
I am the author, so.. I think I like it! but the 2nd edition fixes things in the first edition that today I disagree with.
Recep Karabıçak
May 19, 2019 rated it really liked it
A well written introductory book on the topic of unit testing. It covers a lot of ground, there is even a chapter on how to introduce unit testing to an organization.

But be wary. The book is a highly opiniated one. The author has strong opinions and does not shy away from presenting them. Of course that is not a bad thing but something to keep in mind.
Feb 15, 2019 rated it did not like it  ·  review of another edition
This book is maybe useful to give to someone to persuade them why they should care about unit testing, but is next to useless at making you better at unit testing. XUnit Test Patterns is the canonical book for improving your unit testing skills.
Sang Tran
Feb 17, 2020 rated it really liked it
This review has been hidden because it contains spoilers. To view it, click here.
Apr 16, 2020 rated it it was ok
There's much less discussion about the art of unit testing in this book than you'd expect from the title.
The book does cover various fundamental aspects, but is missing a breadth and depth of discussion.

The book will sometimes mention differences of opinion or technique, but never gets much discussion out of this as to why there might be differences (or what would make sense in different situations). The author's views don't get defended with depth more than "that's just my opinion, what do I kn
Ireney Berezniak
This title has been crossing my path for a number of years now, mainly through Amazon recommendations, and now also Goodreads recommendations. The second edition has been released a few months ago, and so I finally decided to purchase it and see whether I could learn anything from it. I have been a practitioner for many years, and felt that I have mastered the art, but if I learned anything from my years of experience, is that "there is always room for improvement".

Turns out that Osherove's book
Lucas Teixeira
This is a good book for those uninitiated in proper unit testing, but there are a lot o things I didn't like.

The book has a conversational tone, which can be very good, but there's a line writers should not cross. The author insists in using some dumb jokes throughout the book. I was pissed by the third time I read "you have three options: A, B, or quit your job".

Another problem with this book is that it doesn't connect the code examples in a manner that the build on top of each other. Most of t
Sonny Recio
Jun 11, 2017 rated it it was amazing  ·  review of another edition
I would like to give this one a perfect score since it explains a lot of stuff about Unit Testing and how can beginners start cleaner, maintainable code.

In the beginning, I find it hard and challenging to write Unit Tests myself, especially when making TDD due to the fact that I'm not used to the "Test-fail first" approach of coding. But as I go along the book and trying some samples(MULTIPLE TIMES), I was able to grasp the concepts the book was talking about. It took me a lot of time to underst
Vasil Todorov
Feb 07, 2016 rated it it was amazing  ·  review of another edition
A must-read for every .NET developer. Anyway, Java and C# are similar, so it might be useful for Java devs too. The book shows many ways of writing a highly-testable code. Writing good test cases, what needs to be tested, and what not. How to structure our testing project/classes.
Apr 09, 2013 rated it it was amazing  ·  review of another edition
The chapter about answering hard questions is invaluable I you trying to bring unit test to be used! Wish I had read this book back in the day!
Thinh Kieu
Jan 21, 2019 rated it it was amazing  ·  review of another edition
Must-read book for someone who is working on unit tests.
Everything you need to know about unit testing is here.
Jan 18, 2018 rated it it was amazing  ·  review of another edition
Recommends it for: novice and experienced programmers alike
As with many other things, sometimes it is hard to know where to start to explore a new topic of interest, and TDD and unit testing itself was no exception from this. Fortunately for us, the above situation is no longer the case for the aforementioned subjects, as R. Osherove presents us with an excellent starting point with his book (I read the 2nd edition). Before going into (some) specifics though, it is important to note that this book is not about TDD (although it touches the subject), but ...more
James Taylor
Jul 27, 2020 rated it really liked it  ·  review of another edition
Shelves: own
I wouldn’t say I’m an expert at Unit Testing but have done it enough to understand the majority of points the author makes here. I think much of the things discussed I have learnt through experience but have only used the standard library "Microsoft.VisualStudio.TestTools.UnitTesting", Moq and XUnit. The author has worked on TypeMock so does mention it more than other frameworks but he does discuss alternatives too like Rhino Mocks and Moq. I think if you are new to Unit Testing, then you will f ...more
Mohammed Kamil
Feb 25, 2017 rated it really liked it  ·  review of another edition
The writer goes on sharing his distilled knowledge on unit testing and various patterns on making a maintainable automated unit tests, and by giving a clear recommendation on unit testing framework ,the author relief the novice unit tester approacher from the hustle of evaluating different unit test frameworks and giving the reader a solid introductory dose enabling him to adapt unit testing,the book also has a chapter explaining some of the pattern in dealing with introducing automated unit tes ...more
Viktor Nilsson
Jun 24, 2019 rated it liked it
Shelves: programming
This book was a mixed bag for me. On the one hand, explanations are very clear and everything is easy to follow. On the other hand, it's organized quite haphazardly, with references back and forth and with no clear line to follow in order to progress step by step. Much of it reads like a collection of assorted blog posts, and some parts discuss very small details, such as features of different framework versions etc. Such fresh information should not be recorded in a book, since it will quickly ...more
Vỹ Hồng
Jun 21, 2017 rated it really liked it  ·  review of another edition
Shelves: programming
This is a must read for anyone interested in writing good unit tests. The book introduces various concepts, tools, techniques and principles for unit testing. All are valuable.

You'll get most out of this book if you're using a static typed language. If you're using dynamic language, some sections of the book might not be applicable (e.g. constrained vs. unconstrained test framework, design for testability). However, there is still much value to take from this book even if you're using a dynamic
Nilofar Mew
Aug 08, 2017 rated it it was amazing
The book touches pretty much everything related to Unit testing on high level. It is a good book to start with and to get your head around the idea of unit testing.

This will not teach you to write all kind of test that you might write, but it will definitely provide you with all the necessary information that you would need to write any test.

The book of course has Roy's personality all over it. His sarcasm makes it fun and delight reading the book.
Kyle Wilson
Still trying to see where unit test fits in the scheme of things for the sorts of work I do. This book really wasn't all that helpful as its examples showed rather trivial fakes compared to anything I run across and suggested that anything more complex isn't really a unit test. If that is really the case then integration tests meet most of my needs better...
Madan Meena
Jan 04, 2019 rated it it was amazing  ·  review of another edition
When i became serious with whole writing unit test thought process, I started with this book. It gave me good idea and direction and confidence to go about the actual act.
This book will get you to speed about various aspect of unit test writing but you need to actually start writing to get the full benefit of the book.
Vladimir Ananiev
Covers many of the best practices when writing unit tests, and useful tips on getting started.
If you can't tell the difference between a mock and a stub, I would recommend you read this book (one of the best explanations I have found yet).

I found the examples a bit hard to follow and the code snippets were not well-formatted.
Kyle Butler
Jul 04, 2017 rated it it was amazing  ·  review of another edition
A must read for any software professional whether you design, code, or test for a living. Jam packed with insight, real world examples, tips for everything from testing to design for test, it is a wealth of useful actionable information.
Mike Nguyen
Sep 06, 2017 rated it it was amazing  ·  review of another edition
Strongly recommend for software developer who aims to produce bug-free applications. This book not only recommends set of practice of doing TDD properly but also gives suggestion on managing and handling legacy code those without automated tests in the first place.
Tim Dorais
Jan 16, 2020 rated it really liked it  ·  review of another edition
Spends a good amount of time showing how unit tests can be done from scratch before introducing tools and frameworks. Codifies a lot of unit testing practices that many of us know through experience, and makes some interesting points and guidelines for creating maintainable tests.
Eric Henziger
Jan 29, 2020 rated it liked it  ·  review of another edition
Shelves: øredev
Should have read this back in 2009 when it wasn't quite as outdated as it has now become. However, some parts are pretty much timeless, such as Chapter 7 - The pillars of good tests, and still hold their ground. Formatting in code listings are sometimes a bit off, but overall a nice and easy read.
May 11, 2020 rated it it was amazing
It's a really good book, it starts working days from scratch so it's very recommended for people who is new to unto testing. Towards the end gets more interesting and gives more senior advice but overall the books is a must read for whoever works in software development.
Sergey Shchurko
Jun 25, 2017 rated it it was amazing  ·  review of another edition
Excellent introductory book about unit tests. It describes a entire set of aspects related to test.
Branimir Kirilov
In my opinion this book is a must for every .NET developer.
Jeremy West
Dec 31, 2017 rated it it was amazing  ·  review of another edition
Not only a great introduction but also a great reference. It goes from rock bottom to some pretty in depth topics with a pretty good transition.
Eugene Popovych
Nov 24, 2018 rated it it was amazing  ·  review of another edition
Great book to start writing unit tests if you don't know anything about it.
Pat Swanson
Mar 05, 2019 rated it it was amazing  ·  review of another edition
This is, bare none, the best book about unit testing I have ever read.

While it is focused on .Net, a lot of the principles here translate to other languages.
« previous 1 3 next »
There are no discussion topics on this book yet. Be the first to start one »

Readers also enjoyed

  • Clean Code: A Handbook of Agile Software Craftsmanship
  • The Clean Coder: A Code of Conduct for Professional Programmers
  • Design Patterns: Elements of Reusable Object-Oriented Software
  • Clean Architecture
  • Dependency Injection in .NET
  • The Pragmatic Programmer: From Journeyman to Master
  • Refactoring: Improving the Design of Existing Code
  • Working Effectively with Legacy Code
  • Patterns of Enterprise Application Architecture
  • Code Complete
  • C# in Depth
  • Head First Design Patterns
  • Test Driven Development: By Example
  • Domain-Driven Design: Tackling Complexity in the Heart of Software
  • Building Microservices: Designing Fine-Grained Systems
  • Growing Object-Oriented Software, Guided by Tests
  • Microservice Patterns
  • xUnit Test Patterns: Refactoring Test Code
See similar books…

Goodreads is hiring!

If you like books and love to build cool products, we may be looking for you.
Learn more »

Related Articles

San Francisco is a gold rush town. There aren’t many books about people in their 20s who move to Silicon Valley with dreams of earning a living...
34 likes · 2 comments
“Tests are stories we tell the next generation of programmers on a project.” 1 likes
“If you are too lazy to cleanup your database after testing, your filesystem after testing or your memory based system consider moving to a different profession. This isn't a job for you.” 1 likes
More quotes…