Unit Testing in Java : How Tests Drive the Code

個数:
電子版価格 ¥6,576
  • 電書あり

Unit Testing in Java : How Tests Drive the Code

  • 提携先の海外書籍取次会社に在庫がございます。通常2週間で発送いたします。
    重要ご説明事項
    1. 納期遅延や、ご入手不能となる場合が若干ございます。
    2. 複数冊ご注文の場合、分割発送となる場合がございます。
    3. 美品のご指定は承りかねます。
  • 製本 Paperback:紙装版/ペーパーバック版/ページ数 325 p.
  • 言語 ENG
  • 商品コード 9781558608689
  • DDC分類 005.14

Full Description


Software testing is indispensable and is one of the most discussed topics in software development today. Many companies address this issue by assigning a dedicated software testing phase towards the end of their development cycle. However, quality cannot be tested into a buggy application. Early and continuous unit testing has been shown to be crucial for high quality software and low defect rates. Yet current books on testing ignore the developer's point of view and give little guidance on how to bring the overwhelming amount of testing theory into practice. Unit Testing in Java represents a practical introduction to unit testing for software developers. It introduces the basic test-first approach and then discusses a large number of special issues and problem cases. The book instructs developers through each step and motivates them to explore further.

Table of Contents

Foreword                                           v
Erich Gamma
Foreward vii
Frank Westphal
Preface xvii
Part I Basic Techniques
Introduction 3 (20)
Important Terms 5 (1)
XP Testing 6 (5)
Communication, Simplicity, Feedback, 7 (1)
and Courage
Pair Programming 7 (1)
Incremental and Iterative Development 8 (1)
Refactoring 8 (1)
Test Types in XP 9 (1)
XP or Not XP? 10 (1)
Classic Testing 11 (5)
Test-First Development--A Brief Definition 16 (2)
Java Only--Or Other Coffee? 18 (1)
Objectives of This Book 18 (1)
Organization of This Book 19 (1)
Conventions in This Book 20 (1)
Web Site to This Book 21 (2)
Automating Unit Tests 23 (16)
What Do We Want to Automate? 24 (1)
Requirements for an Automation Framework 25 (2)
JUnit 27 (10)
Installing and Running Tests 28 (2)
Creating Test Classes 30 (4)
Fixtures 34 (2)
Creating Test Suites 36 (1)
Summary 37 (2)
Basic Steps of the Test-First Approach 39 (26)
Step by Step 39 (9)
Dependencies 48 (9)
Organizing and Running Tests 57 (6)
Organizing Tests 57 (5)
Running Tests 62 (1)
Summary 63 (2)
Test Ideas and Heuristics 65 (26)
Reworking Single Tests 66 (4)
Black and White Boxes 70 (1)
Testing the Typical Functionality 71 (2)
Threshold Values and Equivalence Classes 73 (2)
Error Cases and Exceptions 75 (6)
Object Interactions 81 (3)
Design by Contract 84 (2)
More Ideas to Find Test Cases 86 (1)
Refactoring Code and Tests 87 (3)
Summary 90 (1)
The Inner Life of a Test Framework 91 (6)
Statics 91 (2)
The Life Cycle of a Test Suite 93 (2)
Project-Specific Expansions 95 (1)
Summary 96 (1)
Dummy and Mock Objects for Independence 97 (46)
Little Dummies 97 (3)
Weltering in Technical Terms 100 (1)
Big Dummies 100 (7)
Extending Our Mansion 107 (1)
Endoscopic Testing 108 (5)
Mock Objects from the Assembly Line 113 (3)
Mock Library 113 (1)
Mock Generators 114 (1)
Mock Objects the Easy Way 114 (2)
Testing Threshold Values and Exceptions 116 (3)
How Does the Test Get to the Mock? 119 (3)
Evil Singletons 122 (2)
Lightweight and Heavyweight Mocks 124 (5)
File Dummies 129 (4)
More Typical Mock Objects 133 (1)
External Components 134 (3)
The Pros and Cons 137 (4)
Heuristics for the Use of Mocks 140 (1)
Summary 141 (2)
Inheritance and Polymorphism 143 (18)
Inheritance 143 (12)
Well-Shaped Inheritance Hierarchies 143 (3)
Reusing Superclass Tests 146 (5)
Test Class Hierarchies by Refactoring 151 (1)
Testing Interfaces 152 (3)
Testing Abstract Classes 155 (1)
Polymorphism 155 (5)
Summary 160 (1)
How Much Is Enough? 161 (12)
The XP Rule 162 (1)
Clear Answers to Clear Questions 163 (4)
Tests per Class 164 (1)
Getters and Setters 164 (1)
Non-Public Object Properties 164 (2)
Complex Interaction Tests 166 (1)
Testing the Tests 167 (1)
Test Coverage 167 (3)
Specification-Based Coverage 168 (1)
Code-Based Coverage 168 (2)
Summary 170 (3)
Part II Advanced Topics
Persistent Objects 173 (28)
Abstract Persistence Interface 175 (3)
Persistent Dummy 178 (3)
Designing a Database Interface 181 (6)
Transactions 182 (2)
Ad Hoc Queries 184 (1)
Object-Centered Persistence 185 (2)
Testing the ``Right'' Persistence 187 (9)
Approaches for Test Data Consistency 191 (1)
Speeding Up the Test Suite 192 (1)
JDBC Mocks 193 (2)
Evolution of the Persistence Technology 195 (1)
Interaction between Persistence Layer and 196 (2)
Client
Summary 198 (3)
Concurrent Programs 201 (24)
Problems Using Threads 202 (2)
Nondeterminism 203 (1)
Target Objects 203 (1)
Testing Asynchronous Services 204 (8)
Service without Result 204 (4)
Service with Result 208 (2)
Expected Exceptions in Split-Off Threads 210 (2)
Unexpected Exceptions 212 (1)
Testing for Synchronization 212 (10)
Simple Test Cases 213 (1)
Concurrent Test Cases 214 (5)
Nondeterministic Test Cases 219 (3)
Summary 222 (3)
Distributed Applications 225 (16)
Distribution Mechanisms in Java 226 (1)
RMI 227 (9)
The Server 227 (5)
The Client 232 (3)
Summary of RMI 235 (1)
Enterprise JavaBeans 236 (4)
Just a Facade 237 (1)
Testing Inside the Container 238 (1)
EJBs and Simple Design 239 (1)
Summary 240 (1)
Web Applications 241 (22)
Functional Tests 242 (5)
Testing on the Server 247 (3)
Testing with Dummies 250 (6)
Separating the Servlet API from the 256 (3)
Servlet Logic
Testing the HTML Generation 259 (2)
Java Server Pages 260 (1)
JSP Custom Tags 260 (1)
Struts 261 (1)
Summary 261 (2)
Graphical User Interfaces 263 (28)
The Direct Way 263 (23)
Brief Summary 283 (2)
Keeping the GUI Clear 285 (1)
Short Detours 286 (4)
JFCUnit 287 (2)
The AWT Robot 289 (1)
Other Tools 290 (1)
Summary 290 (1)
The Role of Unit Tests in the Software 291 (22)
Process
Activities in the Defined Software Process 292 (7)
Activities and Products 292 (2)
Construction Activities 294 (1)
Verification 295 (1)
Validation 296 (1)
Quality Assurance 297 (2)
Process Types and Testing Strategies 299 (6)
Sequential Models 300 (2)
Incremental Models 302 (1)
Evolutionary Models 303 (2)
Continuous Integration 305 (1)
Costs and Benefits of Automated Unit Tests 305 (2)
Commercial Process Models 307 (5)
Rational Unified Process 308 (3)
Extreme Programming 311 (1)
XP versus RUP 312 (1)
Will Automated Unit Tests Fit in My 312 (1)
Process?
Loose Ends and Opportunities 313 (52)
Unit Testing for Existing Software 314 (3)
Testing around Legacy Code 316 (1)
Introducing Unit Tests to the Development 317 (3)
Team
The Craftsmanship Approach 318 (1)
The Organizational Approach 318 (2)
What's Missing? 320 (5)
Part III Appendices
Appendix A Notes to JUnit 325 (10)
A.1 Frequently Asked Questions (FAQs) 325 (1)
How Do I Implement a Test Case for a 326 (1)
Thrown Exception?
How Do I Organize My Test Case Classes? 326 (1)
How Do I Run Setup Code Once for All My 327 (1)
Test Cases?
I Get a ClassNotFoundException When I 327 (1)
Use LoadingTestRunner. What Can I Do?
Why Do I Get Exception XYZ When Using a 328 (1)
Graphical Test Runner, But Not in the
Textual Test Runner?
``assert'' Has Been a Keyword Since JDK 328 (1)
1.4. Isn't There a Conflict with
JUnit's Assert Method?
How Do I Best Integrate JUnit with My 328 (1)
Favorite Development Environment?
A.2 JUnit Expansions 329 (1)
JUnitX and XPTest 329 (1)
Daedalos JUnit Extensions 329 (1)
JFCUnit 330 (1)
JUnitPP 330 (1)
Mock Objects 330 (1)
MockMaker 330 (1)
EasyMock 331 (1)
JXUnit 331 (1)
JUnitHelp 331 (1)
Joshua 331 (1)
JDepend 331 (1)
JesTer 332 (1)
HttpUnit 332 (1)
JUnitEE 332 (1)
Canoo WebTest 333 (1)
Cactus 333 (1)
JUnitPerf 333 (1)
J2ME Unit 333 (1)
Test Mentor Java Edition 334 (1)
Appendix B Unit Tests with Other 335 (30)
Programming Languages
B.1 Smalltalk 335 (1)
Creating Test Cases with SUnit 335 (1)
Differences to Java 336 (1)
Evaluation 337 (1)
B.2 C++ 338 (1)
Installation 338 (1)
Setting Up a Test Project 339 (1)
Creating Test Cases 339 (1)
Running Your Tests 340 (3)
Overall Impression 343 (1)
B.3 The Rest 343 (2)
Glossary 345 (8)
Bibliography and List of References 353 (1)
Bibliography 353 (6)
URLs 359 (3)
Further Reading 362 (1)
Extreme Programming 362 (1)
Test-First and JUnit 363 (1)
Testing Object-Oriented Software 363 (1)
Miscellaneous 364 (1)
Index 365