Book contents
- Frontmatter
- Contents
- INTRODUCTION
- GETTING STARTED WITH JAVA
- MIGRATING TO JAVA
- TECHNIQUES 101
- MODELING AND PATTERNS
- JAVA IN A DISTRIBUTED WORLD
- THREADS
- USER INTERFACES
- SECURITY
- TESTING
- EFFECTIVE TEST STRATEGIES FOR ENTERPRISE-CRITICAL APPLICATIONS
- PUTTING JAVABEANS TO THE TEST
- TEST-INFECTED: PROGRAMMERS LOVE WRITING TESTS
- PERFORMANCE
- REALITY CHECK
- INDEX
TEST-INFECTED: PROGRAMMERS LOVE WRITING TESTS
Published online by Cambridge University Press: 06 July 2010
- Frontmatter
- Contents
- INTRODUCTION
- GETTING STARTED WITH JAVA
- MIGRATING TO JAVA
- TECHNIQUES 101
- MODELING AND PATTERNS
- JAVA IN A DISTRIBUTED WORLD
- THREADS
- USER INTERFACES
- SECURITY
- TESTING
- EFFECTIVE TEST STRATEGIES FOR ENTERPRISE-CRITICAL APPLICATIONS
- PUTTING JAVABEANS TO THE TEST
- TEST-INFECTED: PROGRAMMERS LOVE WRITING TESTS
- PERFORMANCE
- REALITY CHECK
- INDEX
Summary
Testing is not closely integrated with development. This prevents you from measuring the progress of development—you can't tell when something starts working or when something stops working. Using JUnit you can cheaply and incrementally build a test suite that will help you measure your progress, spot unintended side effects, and focus your development efforts.
THE PROBLEM
Every programmer knows they should write tests for their code. Few do. The universal response to “Why not?” is “I'm in too much of a hurry.” This quickly becomes a vicious cycle—the more pressure you feel, the fewer tests you write. The fewer tests you write, the less productive you are and the less stable your code becomes. The less productive and accurate you are, the more pressure you feel.
Programmers burn out from just such cycles. Breaking out requires an outside influence. We found the outside influence we needed in a simple testing framework that lets us do a little testing that makes a big difference.
The best way to convince you of the value of writing your own tests would be to sit down with you and do a bit of development. Along the way, we would encounter new bugs, catch them with tests, fix them, have them come back, fix them again, and so on. You would see the value of the immediate feedback you get from writing and saving and rerunning your own unit tests.
- Type
- Chapter
- Information
- More Java Gems , pp. 357 - 376Publisher: Cambridge University PressPrint publication year: 2000
- 32
- Cited by