xUnit Test Patterns: Refactoring Test Code and over 2 million other books are available for Amazon Kindle . Learn more
£37.59
  • RRP: £46.99
  • You Save: £9.40 (20%)
FREE Delivery in the UK.
Only 2 left in stock (more on the way).
Dispatched from and sold by Amazon.
Gift-wrap available.
Quantity:1
Trade in your item
Get a £11.00
Gift Card.
Have one to sell?
Flip to back Flip to front
Listen Playing... Paused   You're listening to a sample of the Audible audio edition.
Learn more
See all 2 images

xUnit Test Patterns: Refactoring Test Code (Addison Wesley Signature) Hardcover – 21 May 2007


See all 4 formats and editions Hide other formats and editions
Amazon Price New from Used from
Kindle Edition
"Please retry"
Hardcover
"Please retry"
£37.59
£27.05 £23.75

Trade In Promotion


Frequently Bought Together

xUnit Test Patterns: Refactoring Test Code (Addison Wesley Signature) + Test Driven Development (The Addison-Wesley Signature Series) + Clean Code: A Handbook of Agile Software Craftsmanship (Robert C. Martin)
Price For All Three: £84.27

Buy the selected items together


Trade In this Item for up to £11.00
Trade in xUnit Test Patterns: Refactoring Test Code (Addison Wesley Signature) for an Amazon Gift Card of up to £11.00, which you can then spend on millions of items across the site. Trade-in values may vary (terms apply). Learn more

Product details

  • Hardcover: 944 pages
  • Publisher: Addison Wesley; 1 edition (21 May 2007)
  • Language: English
  • ISBN-10: 0131495054
  • ISBN-13: 978-0131495050
  • Product Dimensions: 18.7 x 5.4 x 24.3 cm
  • Average Customer Review: 3.1 out of 5 stars  See all reviews (7 customer reviews)
  • Amazon Bestsellers Rank: 262,928 in Books (See Top 100 in Books)
  • See Complete Table of Contents

More About the Author

Discover books, learn about writers, and more.

Product Description

From the Back Cover

Automated testing is a cornerstone of agile development. An effective testing strategy will deliver new functionality more aggressively, accelerate user feedback, and improve quality. However, for many developers, creating effective automated tests is a unique and unfamiliar challenge.

xUnit Test Patterns is the definitive guide to writing automated tests using xUnit, the most popular unit testing framework in use today. Agile coach and test automation expert Gerard Meszaros describes 68 proven patterns for making tests easier to write, understand, and maintain. He then shows you how to make them more robust and repeatable--and far more cost-effective.

Loaded with information, this book feels like three books in one. The first part is a detailed tutorial on test automation that covers everything from test strategy to in-depth test coding. The second part, a catalog of 18 frequently encountered "test smells," provides trouble-shooting guidelines to help you determine the root cause of problems and the most applicable patterns. The third part contains detailed descriptions of each pattern, including refactoring instructions illustrated by extensive code samples in multiple programming languages.

Topics covered include

  • Writing better tests--and writing them faster
  • The four phases of automated tests: fixture setup, exercising the system under test, result verification, and fixture teardown
  • Improving test coverage by isolating software from its environment using Test Stubs and Mock Objects
  • Designing software for greater testability
  • Using test "smells" (including code smells, behavior smells, and project smells) to spot problems and know when and how to eliminate them
  • Refactoring tests for greater simplicity, robustness, and execution speed

This book will benefit developers, managers, and testers working with any agile or conventional development process, whether doing test-driven development or writing the tests last. While the patterns and smells are especially applicable to all members of the xUnit family, they also apply to next-generation behavior-driven development frameworks such as RSpec and JBehave and to other kinds of test automation tools, including recorded test tools and data-driven test tools such as Fit and FitNesse.


Visual Summary of the Pattern Language 
Foreword

Preface

Acknowledgments

Introduction

Refactoring a Test

PART I: The Narratives
Chapter 1 A Brief Tour
Chapter 2 Test Smells
Chapter 3 Goals of Test Automation
Chapter 4 Philosophy of Test Automation
Chapter 5 Principles of Test Automation
Chapter 6 Test Automation Strategy
Chapter 7 xUnit Basics
Chapter 8 Transient Fixture Management
Chapter 9 Persistent Fixture Management
Chapter 10 Result Verification
Chapter 11 Using Test Doubles
Chapter 12 Organizing Our Tests
Chapter 13 Testing with Databases
Chapter 14 A Roadmap to Effective Test Automation
PART II: The Test Smells 
Chapter 15 Code Smells
Chapter 16 Behavior Smells
Chapter 17 Project Smells
PART III: The Patterns 
Chapter 18 Test Strategy Patterns
Chapter 19 xUnit Basics Patterns
Chapter 20 Fixture Setup Patterns
Chapter 21 Result Verification Patterns
Chapter 22 Fixture Teardown Patterns
Chapter 23 Test Double Patterns
Chapter 24 Test Organization Patterns
Chapter 25 Database Patterns
Chapter 26 Design-for-Testability Patterns
Chapter 27 Value Patterns
PART IV: Appendixes
Appendix A Test Refactorings  
Appendix B xUnit Terminology 
Appendix C xUnit Family Members
Appendix D Tools
Appendix E Goals and Principles
Appendix F Smells, Aliases, and Causes
Appendix G Patterns, Aliases, and Variations
Glossary
References 

Index 


About the Author

Gerard Meszaros is Chief Scientist and Senior Consultant at ClearStream Consulting, a Calgary-based consultancy specializing in agile development. He has more than a decade of experience with automated unit testing frameworks and is a leading expert in test automation patterns, refactoring of software and tests, and design for testability.

Inside This Book (Learn More)
First Sentence
There are a lot of principles, patterns, and smells in this book-and even more patterns that couldn't fit into the book. Read the first page
Browse Sample Pages
Front Cover | Copyright | Table of Contents | Excerpt | Index | Back Cover
Search inside this book:

What Other Items Do Customers Buy After Viewing This Item?

Customer Reviews

3.1 out of 5 stars

Most Helpful Customer Reviews

22 of 22 people found the following review helpful By Thing with a hook on 4 Aug 2007
Format: Hardcover
Let me start by stating the obvious: this is a patterns book about the organisation of tests and the workings of the xUnit family of unit testing frameworks. It is _not_ a book about Test Driven Development, although there is material that is pertinent to that. Given that the use of JUnit and TDD is pretty intertwined in the minds of many Java developers, it's worth making this distinction, so you know what sort of book you're getting. Speaking of JUnit, most of the code examples uses Java, although there are some examples in C#, VB and Ruby.

Like Martin Fowler's Patterns of Enterprise Application Architecture, the book is split into two main sections, a narrative that weaves together a lot of the patterns and strategies, and then a catalogue of individual patterns. Between the two, there is a catalogue of 'test smells', similar to the 'code smells' discussed by Fowler in Refactoring, which I would suggest can be read profitably with the narrative section, rather than used as reference material.

There are a lot of patterns here on the mechanics of xUnit, such as 'Test Runner', 'Garbage-Collected Teardown' and 'Named Test Suite'. I was a bit confused about who this material is aimed at -- maybe someone looking at porting xUnit to a new programming language would find it useful, but a lot of it is fairly obvious to anyone who's used an xUnit in a non-trivial fashion (and certainly, if you haven't done so, this book is not a format that makes for a good introduction), or requires playing against xUnit's strengths (e.g. not putting setup and teardown code in their eponymous methods), although there is good reason for doing so in some of the examples provided, such as databases.

Beyond this, there is some good stuff on design-for-testability patterns (e.g.
Read more ›
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
4 of 4 people found the following review helpful By G. Gilmour on 11 July 2008
Format: Hardcover
The central problem of this book is that in order to justify the 'Patterns' part of the title the author has to abstract the material almost beyond the point of usefulness. Unless you have already discovered most of the techniques the author describes you will be hard pressed to understand his description of them, which does take away the point of buying the book. There is a lot of valuable material hiding in this book, in particular the taxonomy of Mocks / Test Doubles, but you have to work to find it. At over 800 pages the very size of the book is intimidating. Its hard not to contrast this book unfavorably with Next Generation Java Testing: TestNG and Advanced Concepts which explores the same material in a much more practical, focused and helpful manner.
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
1 of 1 people found the following review helpful By Adrian Bates on 27 Feb 2013
Format: Hardcover
I read this book a number of years ago and it was interesting but I have to admit that I did not finish it. I probably read about 2 thirds of it. By the time I was reading the pros & cons of building the test context in the possible different ways for the fourth or fifth time I'm afraid I gave up on it. There is some extremely useful information in here but it is pretty badly buried in unstructured and repetitive writing style. The book's editor appears to have sleep walked through this one.
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
Format: Hardcover
This is a true reference for unit tests. It really covers unit testing in depth.
Highly recommended.
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again


Feedback