Chapter 11 - Testing
Quality is not an act, it is a habit.
Your focus in the preceding chapters has been on getting the League Planet site up and running. In this chapter you'll switch gears and focus on testing it.
It seems that testing is one of those activities that most developers would rather avoid and that many simply do not perform. Those who do not test usually cite time constraints as the primary factor. Those who do test typically perform ad hoc testing by running through some quick, informal, manual tests to verify that their application works as designed. This methodology often breaks down because of the lack of breadth of test coverage and the difficulty in creating repeatable results. It's clear that, unfortunately, many developers do not see the value of testing. Refer to JUnit Test Infected [Beck2002] by Kent Beck, Erich Gamma, and David Saff for an excellent brief account of the importance of testing.
Testing should not be considered optional. Inadequate testing fails to uncover latent problems with your code that can have serious ramifications. In some safety-critical applications, poor testing is simply irresponsible since errors can be both dangerous and expensive. The Therac-25 radiation overdoses, Ariane 5 space shuttle explosion, and Airbus A320-211 plane crash were all caused by faulty software and led to fatalities [Dubrova2005].
Even without looking at dramatic examples, not testing your application tends to require more time than actually testing it in the first place. Maintenance now accounts for roughly half of a developer's time and more than half of the development budget [Stark1996]. Not having enough time is simply not a valid excuse. There are frameworks that provide the facility to easily automate your tests. These frameworks reduce the time requirements for testing and the weight of the "not enough time" argument against testing. And, as any seasoned developer will tell you, there is never enough time anyway regardless of the amount of it you spend testing.
Other Sections in This Chapter
- Automated Testing
- Overview of Iterations
- Iteration 1: Unit Testing with JUnit
- Creating a Test Project
- JUnit Test Case
- JUnit Test Suite
- Summary of Iteration 1
- Iteration 2: Integration Testing with Cactus
- Summary of Iteration 2
- Iteration 3: System Testing with HttpUnit
- Summary of Iteration 3
- Iteration 4: Performance Testing with TPTP
- Creating a Performance Test Project
- HTTP Recording Test
- Generating a Report
- Summary of Iteration 4
- Iteration 5: Profiling with TPTP
- Summary of Iteration 5