xUnit Test Patterns: Refactoring Test Code
(häftad)av Gerard Meszaros
- Format:
- Häftad (paperback)
- Utgiven:
- 2007-06-01
- Språk:
- Engelska
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.
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 ...
(Computer Bookshops Limited)
Passar bra ihop
|
De som köpt den här boken har ofta också köpt Refactoring (inbunden) av Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Roberts | |||
|
Pris för båda:
680:-Köp
|
Kundrecensioner
Bloggat om xUnit Test Patterns: Refactoring Test Code
Övrig information
Gerard Meszaros is a Senior Consultant with ClearStream Consulting, Inc., an Alberta-based advanced technology consulting firm. Over the years he has been involved in a wide range of large-scale, corporate-wide projects, offering specialist services and vast experience to some of the most successful organizations worldwide.
(Computer Bookshops Limited)
Innehållsförteckning
Visual Summary of the Pattern Language xviiForeword xixPreface xxiAcknowledgments xxviIntroduction xxixRefactoring a Test xlvPART I: The Narratives 1 Chapter 1 A Brief Tour 3
About This Chapter 3
The Simplest Test Automation Strategy That Could Possibly Work 3
Development Process 4
Customer Tests 5
Unit Tests 6
Design for Testability 7
Test Organization 7
What's Next? 8
Chapter 2 Test Smells 9About This Chapter 9
An Introduction to Test Smells 9
What's a Test Smell? 10
Kinds of Test Smells 10
What to Do about Smells? 11
A Catalog of Smells 12
The Project Smells 12
The Behavior Smells 13
The Code Smells 16
What's Next? 17
Chapter 3 Goals of Test Automation 19About This Chapter 19
Why Test? 19
Economics of Test Automation 20
Goals of Test Automation 21
Tests Should Help Us Improve Quality 22
Tests Should Help Us Understand the SUT 23
Tests Should Reduce (and Not Introduce) Risk 23
Tests Should Be Easy to Run 25
Tests Should Be Easy to Write and Maintain 27
Tests Should Require Minimal Maintenance as
the System Evolves Around Them 29
What's Next? 29
Chapter 4 Philosophy of Test Automation 31About This Chapter 31
Why Is Philosophy Important? 31
Some Philosophical Differences 32
Test First or Last? 32
Tests or Examples? 33
Test-by-Test or Test All-at-Once? 33
Outside-In or Inside-Out? 34
State or Behavior Verification? 36
Fixture Design Upfront or Test-by-Test? 36
When Philosophies Differ 37
My Philosophy 37
What's Next? 37
Chapter 5 Principles of Test Automation 39About This Chapter 39
The Principles 39
What's Next? 48
Chapter 6 Test Automation Strategy 49About This Chapter 49
What's Strategic? 49
Which Kinds of Tests Should We Automate? 50
Per-Functionality Tests 50
Cross-Functional Tests 52
Which Tools Do We Use to Automate Which Tests? 53
Test Automation Ways and Means 54
Introducing xUnit 56
The xUnit Sweet Spot 58
Which Test Fixture Strategy Do We Use? 58
What Is a Fixture? 59
Major Fixture Strategies 60
Transient Fresh Fixtures 61
Persistent Fresh Fixtures 62
Shared Fixture Strategies 63
How Do We Ensure Testability? 65
Test Last--At Your Peril 65
Design for Testability--Upfront 65
Test-Driven Testability 66
Control Points and Observation Points 66
Interaction Styles and Testability Patterns 67
Divide and Test 71
What's Next? 73
Chapter 7 xUnit Basics 75About This Chapter 75
An Introduction to xUnit 75
Common Features 76
The Bare Minimum 76
Defining Tests 76
What's a Fixture? 78
Definin...
(Computer Bookshops Limited)