xUnit Test Patterns: Refactoring Test Code (häftad)
Format
Häftad (Paperback)
Språk
Engelska
Antal sidor
944
Utgivningsdatum
2007-06-01
Upplaga
illustrated ed
Förlag
ADDISON-WESLEY
Illustrationer
illustrations
Dimensioner
242 x 182 x 50 mm
Vikt
1500 g
Antal komponenter
1
ISBN
9780131495050

xUnit Test Patterns: Refactoring Test Code

(1 röst)  |   Läs 1 recension
Häftad,  Engelska, 2007-06-01

Slutsåld

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 ...

Kundrecensioner

Det finns 1 recension av xUnit Test Patterns: Refactoring Test Code. Har du också läst boken? Om du har köpt den på Bokus.com vill vi gärna höra vad du tyckte om den! Sätt ditt betyg »
  1. Fantastisk bok om enhetstestning! Förutom att bara...
    Emil Carlsson, 15 april 2013

    Fantastisk bok om enhetstestning! Förutom att bara lista olika mönster och sina personliga favoriter så går författaren igenom hur man bör tänka som testare som arbetar med enhetstester. Den är skriven så att en programmerare som vill lära sig mer om enhetstester har stor nytta av boken. Man bör dock kunna lite om enhetstester innan man börjar läsa boken, men det är inget krav för att få vinning av den.

Ö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.

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 9

About 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 19

About 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 31

About 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 39

About This Chapter 39

The Principles 39

What's Next? 48

Chapter 6 Test Automation Strategy 49

About 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 75

About This Chapter 75

An Introduction to xUnit 75

Common Features 76

The Bare Minimum 76

Defining Tests 76

What's a Fixture? 78

Definin...