Test for fun and profit, Part 1
Learn how to ensure your Java applications make the grade
By Todd Sundsted, JavaWorld.com, 10/20/99
Page 3 of 4
First, a programming language, by itself, cannot insulate you from defects arising from a poor understanding of the requirements,
nor can it prevent many errors related to logic (typing < rather than > in a comparison, for example).
Second, Java can't prevent you from accidentally replacing a working version of a program module with a previous nonworking
version. This class of defects actually includes a number of related source-code control problems (for example, Java can't
prevent some klutz from editing your source code and breaking it).
Finally, Java's nonsupport of programming contracts (à la Eiffel) makes it possible for subclasses to ignore the published
semantics of a superclass, thereby introducing defects when the subclass is incorporated into a framework.
For these reasons and more, Java programs -- just like their non-Java brethren -- require testing.
Vocabulary
In the testing vernacular there are a number of terms that you'll frequently encounter.
- White-box testing
- White-box testing is a design strategy. It treats a software component like a transparent box into which test designers can
peek while designing a test. Test designers can take advantage of their knowledge of the component's implementation to design
tests that will cover all possible paths of execution through the component.
- Black-box testing
- Black-box testing is another design strategy. It treats a software component like an opaque box. Test designers seek to test
how well the component conforms to the published requirements for the component, rather than concerning themselves with the
implementation.
- Unit and component testing
- Unit and component tests seek to test the building blocks of an application, typically in isolation from the application's
other units and components. Units are generally the atomic elements of an application (single classes, for instance), while
components may be composed of one or more units.
- Integration testing
- Integration tests assess the integration and communication between the components and systems that compose an application.
- System testing
- System testing seeks to uncover defects that are properties of the entire system or application rather than of its individual
components. This category includes defects due to resource utilization, performance, security, and recovery.
- Scenario testing
- Scenario testing aims to test an application against a realistic set of common uses, perhaps as embodied by the business scenarios
and use cases used to drive the design process.
- Regression testing
- Regression testing refers to the practice of testing a modified version of a component or application in order to ensure that
prior features are still intact. A regression test suite typically includes a set of tests that fully exercise the features
of a component or application.
- Beta testing
- Beta testing consists of distributing a prerelease version of a product to a subset of its intended audience for the purpose
of obtaining real-world feedback. When done properly, it's a formal process with well-defined feedback channels. Distributing
prerelease software to every taker on the Internet is called marketing.
Conclusion
I hope this month's column has given you an overview of the important role testing plays in the software development process.
All real applications, even those written in Java, need to be tested, both during development and before the final product
ships. If you keep this fact in mind while you design and build your Java applications, and implement some of the strategies
I'll cover in the next several months, your applications will benefit, your clients will be happier, and you will, I hope,
reap great financial reward.