Dandi8 rated xUnit Test Patterns: 4 stars

xUnit Test Patterns by Gerard Meszaros
Automated testing is a cornerstone of agile development. An effective testing strategy will deliver new functionality more aggressively, accelerate user …
This link opens in a pop-up window
Automated testing is a cornerstone of agile development. An effective testing strategy will deliver new functionality more aggressively, accelerate user …
Reading this book was a mixed experience. While it addresses an important and often neglected topic, several aspects left me unimpressed and somewhat concerned.
The author presents some dubious techniques, such as using a glorified service locator singleton as an alternative to constructor injection (p.64, 2nd ed.), which would outright break parallel testing, without mentioning it. In fact, the book ignores the need for parallel testing altogether, presenting patterns which are not thread-safe as best practice techniques.
Some of the presented methods of creating testing seams in the code (such as using a service locator singleton, or exposing overridable methods solely for the purpose of testing - dubbed "Extract and Override") are unlikely to produce maintainable code, but the book makes no distinction between best practices and academic debate. Perhaps some of them were meant only for legacy projects, but that was not stated in the book. What's worse, some …
Reading this book was a mixed experience. While it addresses an important and often neglected topic, several aspects left me unimpressed and somewhat concerned.
The author presents some dubious techniques, such as using a glorified service locator singleton as an alternative to constructor injection (p.64, 2nd ed.), which would outright break parallel testing, without mentioning it. In fact, the book ignores the need for parallel testing altogether, presenting patterns which are not thread-safe as best practice techniques.
Some of the presented methods of creating testing seams in the code (such as using a service locator singleton, or exposing overridable methods solely for the purpose of testing - dubbed "Extract and Override") are unlikely to produce maintainable code, but the book makes no distinction between best practices and academic debate. Perhaps some of them were meant only for legacy projects, but that was not stated in the book. What's worse, some of those methods are described as the author's favorites.
For code reuse, the author suggests using test inheritance, completely ignoring composition or annotations, which in my opinion are usually much better alternatives.
Furthermore, the author claims that designing for code testability isn't important in dynamic languages, because code written in them is somehow inherently testable. To me, that's missing the forest for the trees - just because you can technically test something, doesn't mean you can test it well, in a maintainable and readable way. I was not successfully convinced by that claim.
Additionally, the book seems overly reliant on C# as the programming language. It's not just examples that are in C# - entire chapters talk about .NET tools for tests.
I was hoping to find answers to some tough questions of unit testing, but finished reading having not learned much more than I already knew.
It's not all bad, thankfully, and there are some solid basics of unit testing presented, as well as some great book recommendations (such as the works of Eric Evans, Robert C. Martin). Some good behaviors are also promoted, such as achieving 100% code coverage, though I was disappointed to see mutation testing being omitted entirely in that conversation. There is some genuinely good advice here (like using the Arrange-Act-Assert format, or only testing one thing at a time), but it's marred by the aforementioned issues.
In the end, I think it's an OK introduction for a beginner or mid-level C# developer - with the caveat that not all of the advice should be believed. Anyone more advanced is likely to find little value, unless they're really behind on their knowledge of mocks and stubs.
As a big proponent of DDD, I'm really sorry to have to write this, but reading this book was the polar opposite experience to reading Eric Evans' "Domain-Driven Design".
Unfortunately, this book is bloated, extremely verbose and generally hard to read - in my opinion much harder than Evans' blue book.
It is not a good introduction to DDD, assuming at every step that you've read Evans' book, while at the same time quoting it often. The author seems to have filled the pages with repetitions, quotes and meandering technical explanations to the point where the subject of the chapter is often lost.
It uses some questionable patterns, such as Service Locator, wiring Spring beans using XML or using @Autowired instead of constructor injection, which makes it hard to recommend as a basis for anyone's project. It seems, also, to have skipped some important topics, such as how to deal …
As a big proponent of DDD, I'm really sorry to have to write this, but reading this book was the polar opposite experience to reading Eric Evans' "Domain-Driven Design".
Unfortunately, this book is bloated, extremely verbose and generally hard to read - in my opinion much harder than Evans' blue book.
It is not a good introduction to DDD, assuming at every step that you've read Evans' book, while at the same time quoting it often. The author seems to have filled the pages with repetitions, quotes and meandering technical explanations to the point where the subject of the chapter is often lost.
It uses some questionable patterns, such as Service Locator, wiring Spring beans using XML or using @Autowired instead of constructor injection, which makes it hard to recommend as a basis for anyone's project. It seems, also, to have skipped some important topics, such as how to deal with discrepancies between the needs of the domain model and the needs of the ORM - I was expecting to see some neat solutions for mapping between domain and infrastructure. Instead, the author just maps queries to the domain model, as if that was always possible.
The book makes some ideas, such as ports and adapters, seem unnecessarily complicated, while others are not explained clearly enough. Having used many of them in my projects, I was still scratching my head when reading about them here.
The example project (SaasOvation), while using a domain most are familiar with, is somehow still hard to understand from a business perspective. Why does a Scrum project need a "Forum"? What, exactly, is a "Discussion" in that context, if it's not part of the "Forum"?
Perspectives vary, of course, but I was shocked at how difficult a read this was, while leaving me not much wiser in the ways of DDD. If you're determined, you may get something out of this (there is knowledge buried here), but I strongly recommend at least reading Evans' work first. If you do decide to give this one a shot, pay attention not to pick up some bad habits along the way.
Conversion of hardcopy paperback originally owned bu Boston Public Library. ePub version lacks material that was originally on the first …
It was January 2021, and Rick Deckard had a license to kill. Somewhere among the hordes of humans out there, …