xUnit Test Patterns by Gerard Meszaros is a huge book. It is almost 900 pages of patterns to be used for test automation and for unit testing. This book contains a huge amount of useful knowledge for developers and is, without a doubt, the most thorough book on writing well-structured unit tests. The largest drawback of the book is its size and the amount of duplication.
The book consists of three parts. The first part is normal prose introducing the patterns and their contexts. The second part is a catalog of test smells and the last part (which is most of the book) describes the test patterns.
The first part of the book is excellent. It contains a couple of chapters related to test automation that are not specific to xUnit test automation. Chapter two introduces test smells, which I found very helpful. Chapter three contains the goals of test automation. This was one of the clearest descriptions I've seen which answer the question "why do we want to do this in the first place." The next chapters are about philosophy (e.g. TDD), principles and strategy. Chapter second introduces xUnit basics and the rest of the chapters of this part are narratives around the pattern sets (chapters) which are introduces further on in the book. The first part is about 180 pages of the book and is definitively worth reading completely. The individual chapters are short and easy to read.
The second part of the book covers test smells. The test smells are grouped intro three categories: code smells, behavior smells and project smells. These smells are also linked to each other, explaining what the "higher level smell" is caused by. I'm afraid I've seen all the smells in real life in the past and thus this part was very recognizable. Nowadays, I often send these smells to people I work with, since Gerard described them perhaps better than I ever could. The test smells are less than a hundred pages
The third part of the book are the test patterns. They are grouped in 'test pattern categories' with each category containing as little as four and as much as ten patterns. The pattern format Gerard uses is clear and easy to read. The largest drawback is that the pattern format causes quite a lot of duplication, especially across patterns. This is because the book is written so that each pattern can be read independently of others. This is good, but for people who read whole books (me) it causes the book to be somewhat boring to read (even though the content is interesting, just felt bored when reading again that there is one exception to object per test-case implementation of most xUnit frameworks).
The first chapter in part three is test strategy patterns, describing different approaches to testing (and this one is not specific to xUnit tests). The next chapter introduces xUnit frameworks written down in pattern form. Fixture setup is next in which the author describes the advantages and disadvantages for fresh vs shared fixtures and how to set them up. Chapter 21 then dives into the assertion parts of an xUnit framework describing the difference between state and behavior verification. Patterns such as custom assertions are frequently used in well-written test code. Next are the teardown patterns in which the authors somewhat promote the automated teardown (something I've not encountered very often in development). Chapter 23 is probably one of the best known chapters where Gerard categorizes test doubles (mocks/stubs/fakes) and describes when to use which term and why? This terminology is far from standardized and his effort to bring clarity in these terms is much appreciated. Next are test organization patterns such as how and where do you split your test case. Chapter 25 covers working with databases. Chapter 26 some general miscellaneous pattern in design which promote low coupling and thus increase testability. The final chapter relates to values within your tests.
The book also (for if this wasn't enough for you) contains over a hundred pages of appendixes. The refactorings, terminology mapping and glossary are useful.
Gerards book is huge. It contains useful insights related to unit testing and writing clean test code. From that perspective, this book is recommended for everyone serious about writing well-factored unit tests. However, the book also contains relative trivial things and, as mentioned, it contains a huge amount of duplication between different parts. This means that perhaps reading the book from cover to cover might not be the best approach :) Part one and two should definitively be read completely, but the patterns in chapter 3 are better browsed and read when needed or e.g. one per week. Another annoying part in the book, for me, was the way Gerard uses comments. Most comments in the code were not useful and made the code obscure and hard to read at times. Wished he had left them out (though, I guess this relates to coding style a lot).
Conclusion. Definitively worth reading or at least browsing for anyone serious about xUnit and test automation. Because of the duplication and the comments, I'd rate it four out of five stars. Personally I'd rather see a small 100 page book containing the summary and conclusions of what Gerard is talking about. It doesn't exist yet, so this book is, at this moment, the best on this particular subject.
是否有货?

下载免费的 Kindle 阅读软件,即可立即在智能手机、平板电脑或电脑上阅读 Kindle 电子书 - 无需 Kindle 设备。了解更多信息
使用手机摄像头 - 扫描以下代码并下载 Kindle 阅读软件。

前翻 后翻
xUnit Test Patterns: Refactoring Test Code 精装
英语版本
无需Kindle设备,下载免费Kindle阅读软件,即可在您的手机、电脑及平板电脑上畅享阅读。
无顾客评论
5 星 (0%) |
|
0% |
4 星 (0%) |
|
0% |
3 星 (0%) |
|
0% |
2 星 (0%) |
|
0% |
1 星 (0%) |
|
0% |
评分是如何计算的?
在计算总星级评分以及按星级确定的百分比时,我们不使用简单的平均值。相反,我们的系统会考虑评论的最新程度以及评论者是否在亚马逊上购买了该商品。系统还会分析评论,验证评论的可信度。
此商品在美国亚马逊上最有用的商品评论
美国亚马逊:
4.2 颗星,最多 5 颗星
30 条评论

Bas Vodde
4.0 颗星,最多 5 颗星
More xUnit patterns than you would wish!
2009年6月23日 -
已在美国亚马逊上发表已确认购买
8 个人发现此评论有用

Puneet S. Lamba
5.0 颗星,最多 5 颗星
An authoritative work
2013年3月10日 -
已在美国亚马逊上发表已确认购买
Like the rest of the books in Martin Fowler's signature series, this is an authoritative work on the important subject of unit testing. This is, however, a big book (900 odd pages) and I have no intention of reading it cover to cover. The parts I've gone through are extremely well presented and I have already learned a lot from them. For example, what's the difference between a mock and a stub? The book does have areas of redundancy. For example, there's a fair bit of overlap between chapters 11 (Using Test Doubles) and 23 (Test Double Patterns). I hope I never have to eat these words, but so far I've experienced that investing in a Martin Fowler series book always pays off big time, often in ways you don't imagine. For example, I didn't think that a book on unit test patterns would help to reinforce my concepts on types of inversion of control (IoC) or refactoring, but it did!
2 个人发现此评论有用

AB3
5.0 颗星,最多 5 颗星
title should be: best test automation book ever
2017年5月2日 -
已在美国亚马逊上发表已确认购买
Every software test engineer should learn this book. Every software developer would rise high above their peers if they understand these concepts. A tour de force of software test automation. As to complaints about length and repetition, read the first half as a story, and use the second half as a reference. An amazingly thorough analysis of how to validate software. A timeless volume because it teaches concepts, and is not tied to any framework. The title is misleading because the book is not primarily about xUnit test patterns or refactoring. If you learn this book, you'll never want for work as a software test engineer.
2 个人发现此评论有用

David Moore
5.0 颗星,最多 5 颗星
The Reference on xUnit and Automated Testing Patterns
2016年3月11日 -
已在美国亚马逊上发表已确认购买
The book to read if you want to really understand the xUnit tools, automated testing, and best practices when using them. Even though it was written a number of years ago, it's still very relevant today. Mr. Meszaros obviously has a real depth of experience in testing that he pulls from for this volume. It's a lengthy book, but well worth the read if you want to write better tests, or if you want to develop an xUnit framework. He refers often to Martin Fowler's Refactoring, as well as other books such as the GOF Patterns book, so it might be good to have those handy or read them as well. I will say, it took me quite a while to finally get through this whole book but I was glad I did and read through all of the patterns as well as the "smells". Good stuff, and thanks to Gerard for putting so much time and effort into compiling this volume.
1 个人发现此评论有用

H. Hemken
4.0 颗星,最多 5 颗星
A monumental work
2012年12月28日 -
已在美国亚马逊上发表已确认购买
If you want to know pretty much all there is to know, or at least far more than you really need to know, here's your chance. There is enough practical information and experience in this guide to kick-start you from nothing to well informed within a few weeks. Whether you can implement all that practice into your work is another story, but at least you have the both the 50,000 ft view and the gory details at your fingertips.
1 个人发现此评论有用