
The art of unit testing
by Roy Osherove · first published 2009
18mentions
12recommended by
17HN commenters
2012–2026first – last mentioned
71% recommend29% neutral
Why HN recommends it
A practical, pragmatic guide to writing unit tests and a natural next step after TDD basics. It offers hands-on advice for working developers, with some C#-specific material.
Summarised by Claude from recommending comments
Affiliate links. As an Amazon Associate I earn from qualifying purchases.






…the process of changing the software later on. The Art of Readable Code by Dustin Boswell & Trevor Foucher Don't Make Me Think 2ed by Steve Krug Remote: Office not Required by Jason Fried & DHH The Art of Unit Testing by Roy Osherove Code Complete 2 by Steve McConnell Refactoring: Improving the Design of Existing Code by Martin Fowler The Practice of Programming by Brian Kernighan & Rob Pike JavaScript: The Good…
on “Ask HN: What book changed your life in 2013?” ↗Technical concepts for writing code: -------------------------------------- Clean Code (Robert Cecil Martin) The Art of Unit Testing (Roy Osherove) Head First Design Patterns (Elisabeth Freeman, Kathy Sierra) Martin Fowler's blog: https://martinfowler.com/ . How to gather requirements and write business-readable code: --------------------------------------…
on “Ask HN: What are your go-to blogs and books on building business applications?” ↗…you use, though of course examples are written in a language. ## Monographs Test Driven Development By Example (Kent Beck) Unit Testing: Principles, Practices, and Patterns (Vladimir Khorikov) The Art of Unit Testing 2nd ed (Roy Osherove) Working Effectively with Legacy Code (Michael Feathers) ## Various resources [Unit Testing Best Pratices](https://www.youtube.com/watch?v=k_ItB5btREU&t=2931s&ab_chann...) (Vladimir…
on “Ask HN: Any good software testing resources?” ↗The Art of Unit Testing by Roy Osherove is indeed amazing. Thanks to it I now write much better unit tests, and as a result of removed frustration I do it much more often.
on “Ask HN: What book changed your life in 2013?” ↗I see you read Kent Beck's TDD book. A good follow-up might be Roy Osherove's "The Art of Unit Testing." I found it to have a lot of pragmatic, practical advice. It's not the final word, but it is a good next step after Kent Beck's book. It has some C#-specific material, but that stuff is interesting to…
on “Ask HN: What language-agnostic programming books should I read?” ↗I recommend reading The Art of Unit Testing -> https://www.manning.com/books/the-art-of-unit-testing . At least this is the book I learned TDD from more than 10 years ago and the knowledge I gained from the book has proven to be timeless.
on “Is TDD Dead? (2014)” ↗I found quite useful an example I read in the book "The Art of Unit Testing" by Roy Osherove, it was something like this (I don't have it at hand, I repeat it from memory): Suppose you have to test the irrigation system of a tree in your garden, you want to test how many times…
on “Mocks Aren't Stubs (2007)” ↗Looking at my bookshelf, there are three books that I've re-opened as references for a while that have a significant impact on my current work: 1. Refactoring/Fowler 2. Design Patterns/Gang of Four 3. The Art of Unit Testing/Osherove Although, the last book (Unit Testing) is C# specific, what I appreciated was the open discussion of using techniques and tools, rather than ideology.
on “Ask HN: What reads made you a better engineer?” ↗Oh god mocks/fakes/doubles. The best answer to that probably comes from The Art of Unit Testing as explained on SO: http://stackoverflow.com/a/33333064/2136440. In short yea, you're right.
on “.NET mocking frameworks, a comparison” ↗…time. Not particularly for a specific technology, especially in fast-moving domains like web dev, but for more broad practice and theory, the concepts are more timeless. Think Code Complete, or The Art of Unit Testing, or Working Effectively with Legacy Code, or Peopleware. I'm also a fan of the Syncfusion Succinctly series[1]. They are short, quick overviews of a particular tech, that you can pretty easily go through…
on “Ask HN: Do you still buy/read technical books?” ↗The book mentioned below is basically the defacto book on TDD; but if you are in the .NET ecosystem (or know how to read C# pretty well) and want to read a nice practical one I can really recommend The Art Of Unit Testing published by Manning: https://www.manning.com/books/the-art-of-unit-testing-second... Also note that these days all popular commercial IDEs (Visual Studio, IDEA, Rider) have great builtin support for…
on “Ask HN: Practical Guide to TDD?” ↗…Software Runaways, Glass http://amzn.to/2qT2mHn Sorting and Searching, Knuth http://amzn.to/2qQ4NWQ Structure and Interpretation of Computer Programs, Abelson and Sussman http://amzn.to/2qTflsk The Art of Unit Testing, Manning http://amzn.to/2rsERDu The Art of Unix Programming, ESR http://amzn.to/2sIAXUZ The Design of Design: Essays from a Computer Scientist, Brooks http://amzn.to/2rsPjev The Effective Engineer,…
on “Ask HN: What language-agnostic programming books should I read?” ↗Really? Click on the issue link (article), then once you've read it, click on the Downloads link. There is Manning 2009 Art of Unit Testing, and some random thai/viet filenames that go along with the rest of the project, which seems to contain nothing original -- but I can't say for sure, I don't talk thai.
on “Issue report: You are illegally sharing my fucking book ” ↗Well, that's too amazing to be true - as part of my preparation I started reading "The Art of Unit Testing" just a couple days ago (not that I did not write tests before, but got a suggestion that the book will help me better understand dependency injection, inversion of control etc.)
on “Ask HN: How to Be a Good Technical Lead?” ↗Do you have any suggestions on where to learn more about testing? I've gone through numerous tutorials and read through The Art of Unit Testing but I still feel like I'm writing tests just to write tests. It's not really clicking for me
on “Software has diseconomies of scale, not economies of scale” ↗