Unit Testing in Java -  Johannes Link

Unit Testing in Java (eBook)

How Tests Drive the Code
eBook Download: PDF
2003 | 1. Auflage
376 Seiten
Elsevier Science (Verlag)
978-0-08-052017-9 (ISBN)
Systemvoraussetzungen
47,68 inkl. MwSt
  • Download sofort lieferbar
  • Zahlungsarten anzeigen
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.

*Shows how the discovery and avoidance of software errors is a demanding and creative activity in its own right and can build confidence early in a project.
*Demonstrates how automated tests can detect the unwanted effects of small changes in code within the entire system.
*Discusses how testing works with persistency, concurrency, distribution, and web applications.
*Includes a discussion of testing with C++ and Smalltalk.
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. - Shows how the discovery and avoidance of software errors is a demanding and creative activity in its own right and can build confidence early in a project. - Demonstrates how automated tests can detect the unwanted effects of small changes in code within the entire system. - Discusses how testing works with persistency, concurrency, distribution, and web applications. - Includes a discussion of testing with C++ and Smalltalk.

Front Cover 1
Unit Testing in Java: How Tests Drive the Code 4
Copyright Page 5
Contents 10
Foreword 6
Foreward 8
Preface 18
Part l: Basic Techniques 20
Chapter 1. Introduction 22
1.1 Important Terms 24
1.2 XP Testing 25
1.3 Classic Testing 30
1.4 Test-First Development–A Brief Definition 35
1.5 Java Only-Or Other Coffee? 37
1.6 Objectives of This Book 37
1.7 Organization of This Book 38
1.8 Conventions in This Book 39
1.9 Web Site to This Book 40
Chapter 2. Automating Unit Tests 42
2.1 What Do We Want to Automate? 43
2.2 Requirements for an Automation Framework 44
2.3 JUnit 46
2.4 Summary 56
Chapter 3. Basic Steps of the Test-First Approach 58
3.1 Step by Step 58
3.2 Dependencies 67
3.3 Organizing and Running Tests 76
3.4 Summary 82
Chapter 4. Test Ideas and Heuristics 84
4.l Reworking Single Tests 85
4.2 Black and White Boxes 89
4.3 Testing the Typical Functionality 90
4.4 Threshold Values and Equivalence Classes 92
4.5 Error Cases and Exceptions 94
4.6 Object Interactions 100
4.7 Design by Contract 103
4.8 More Ideas to Find Test Cases 105
4.9 Refactoring Code and Tests 106
4.10 Summary 109
Chapter 5. The Inner Life of a Test Framework 110
5.1 Statics 110
5.2 The Life Cycle of a Test Suite 112
5.3 Project-Specific Expansions 114
5.4 Summary 115
Chapter 6. Dummy and Mock Objects for Independence 116
6.1 Little Dummies 116
6.2 Weltering in Technical Terms 119
6.3 Big Dummies 119
6.4 Extending Our Mansion 126
6.5 Endoscopic Testing 127
6.6 Mock Objects from the Assembly Line 132
6.7 Testing Threshold Values and Exceptions 135
6.8 How Does the Test Get to the Mock? 138
6.9 Evil Singletons 141
6.10 Lightweight and Heavyweight Mocks 143
6.11 File Dummies 148
6.12 More Typical Mock Objects 152
6.13 External Components 153
6.14 The Pros and Cons 156
6.15 Summary 160
Chapter 7. Inheritance and Polymorphism 162
7.1 Inheritance 162
7.2 Polymorphism 174
7.3 Summary 179
Chapter 8. How Much Is Enough? 180
8.1 The XP Rule 181
8.2 Clear Answers to Clear Questions 182
8.3 Test Coverage 186
8.4 Summary 189
Part II: Advanced Topics 190
Chapter 9. Persistent Objects 192
9.1 Abstract Persistence Interface 194
9.2 Persistent Dummy 197
9.3 Designing a Database Interface 200
9.4 Testing the"Right" Persistence 206
9.5 Interaction between Persistence Layer and Client 215
9.6 Summary 217
Chapter 10. Concurrent Programs 220
10.1 Problems Using Threads 221
10.2 Testing Asynchronous Services 223
10.3 Testing for Synchronization 231
10.4 Summary 241
Chapter 11. Distributed Applications 244
11.1 RMI 246
11.2 Enterprise JavaBeans 255
11.3 Summary 259
Chapter 12. Web Applications 260
12.1 Functional Tests 261
12.2 Testing on the Server 266
12.3 Testing with Dummies 269
12.4 Separating the Servlet API from the Servlet Logic 275
12.5 Testing the HTML Generation 278
12.6 Summary 280
Chapter 13. Graphical User Interfaces 282
13.1 The Direct Way 282
13.2 Short Detours 305
13.3 Summary 309
Chapter 14. The Role of Unit Tests in the Software Process 310
14.1 Activities in the Defined Software Process 311
14.2 Process Types and Testing Strategies 318
14.3 Costs and Benefits of Automated Unit Tests 324
14.4 Commercial Process Models 326
14.5 Will Automated Unit Tests Fit in My Process? 331
Chapter 15. Loose Ends and Opportunities 332
15.1 Unit Testing for Existing Software 333
15.2 Introducing Unit Tests to the Development Team 336
15.3 What's Missing? 339
Part III: Appendices 342
Appendix A. Notes to JUnit 344
A.1 Frequently Asked Questions (FAQs) 344
A.2 JUnit Expansions 348
Appendix B. Unit Tests with Other Programming Languages 354
B.1 Smalltalk 354
B.2 C++ 357
B.3 The Rest 362
Glossary 364
Bibliography and List of References 372
Bibliography 372
URLs 378
Further Reading 381
Index 384

Erscheint lt. Verlag 10.6.2003
Co-Autor Peter Frohlich
Sprache englisch
Themenwelt Sachbuch/Ratgeber
Informatik Programmiersprachen / -werkzeuge Java
Mathematik / Informatik Informatik Web / Internet
ISBN-10 0-08-052017-0 / 0080520170
ISBN-13 978-0-08-052017-9 / 9780080520179
Haben Sie eine Frage zum Produkt?
PDFPDF (Adobe DRM)

Kopierschutz: Adobe-DRM
Adobe-DRM ist ein Kopierschutz, der das eBook vor Mißbrauch schützen soll. Dabei wird das eBook bereits beim Download auf Ihre persönliche Adobe-ID autorisiert. Lesen können Sie das eBook dann nur auf den Geräten, welche ebenfalls auf Ihre Adobe-ID registriert sind.
Details zum Adobe-DRM

Dateiformat: PDF (Portable Document Format)
Mit einem festen Seiten­layout eignet sich die PDF besonders für Fach­bücher mit Spalten, Tabellen und Abbild­ungen. Eine PDF kann auf fast allen Geräten ange­zeigt werden, ist aber für kleine Displays (Smart­phone, eReader) nur einge­schränkt geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen eine Adobe-ID und die Software Adobe Digital Editions (kostenlos). Von der Benutzung der OverDrive Media Console raten wir Ihnen ab. Erfahrungsgemäß treten hier gehäuft Probleme mit dem Adobe DRM auf.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen eine Adobe-ID sowie eine kostenlose App.
Geräteliste und zusätzliche Hinweise

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich
Einführung, Ausbildung, Praxis

von Christian Ullenboom

eBook Download (2023)
Rheinwerk Computing (Verlag)
34,93
Moderne GUIs für RIAs und Java-Applikationen

von Ralph Steyer

eBook Download (2022)
Springer Fachmedien Wiesbaden (Verlag)
42,99