After reading this chapter, you should have an appreciation of the important role testing has to play throughout the software development lifecycle. The testing activity is more than a backstop at the end of the project for catching defects. It is critical to rapid application development, which can be greatly facilitated by putting in place an automated unit test suite for the project. The presence of this test suite and the adoption of a test-driven approach to development offers two major benefits:


The project team can respond quickly and accurately to any changes, whether in the form of updated end-user requirements or design modifications. All changes can be immediately validated with the unit test suite, thereby providing a safety net for potentially sweeping changes to the design and code base.

The ability to absorb changes without adversely impacting the project's timeframe and compromising quality is an essential ingredient for successful rapid application development.


The cost of resolving defects in a system increases as the application progresses through the stages of the software development lifecycle. Defects detected during a formal system test by a dedicated quality-assurance team incur a far higher penalty than those detected early in the process during implementation. By having the development team adopt a rigorous, upfront approach to testing, the quality of releases into the formal test environment is improved, thereby reducing the number of defects detected at the later stages of the project.

Unit tests also reduce the time it takes to resolve a defect, since unit tests make it easily reproducible. Furthermore, adopting a test-driven approach helps instill the importance of testing for producing quality software within the project team.

In the next chapter, we keep the focus on the testing effort but broaden the scope to include tools and techniques for automating the process of conducting functional and load-based testing.

Additional Information

The process of writing unit tests has gathered a critical mass of knowledge thanks to the large take up of JUnit, and a set of best practices has emerged from the wider developer community for writing effective units tests. To find out more about the intricacies of automated unit testing, the JUnit site found at is an excellent starting point and provides an extensive set of links to literature on the subject.

Kent Beck has published a book, Test Driven Development by Example [Beck, 2002], on test-driven development that illustrates the entire process with a complete example.

For more details on mocks, the uncontested home of mock objects on the Web is The site provides an extensive amount of information on anything and everything relating to mock objects.

    Rapid J2EE Development. An Adaptive Foundation for Enterprise Applications
    Rapid J2EEв„ў Development: An Adaptive Foundation for Enterprise Applications
    ISBN: 0131472208
    EAN: 2147483647
    Year: 2005
    Pages: 159
    Authors: Alan Monnox © 2008-2017.
    If you may any questions please contact us: