Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

Sponsored Links

Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs

Tools of the trade, Part 2

Jtest statically and dynamically analyzes your Java code

  • Print
  • Feedback

Sun Microsystems' Java 2 SDK tools prove helpful for building small Java programs. However, they lack features for the rapid development and thorough testing that large Java programs need. Furthermore, no SDK tool simplifies the installation of a Java program's classfiles (and other files) on multiple platforms. Thus, a world of non-SDK Java tools have evolved, tools that facilitate the development, testing, and installation of Java programs. In this series, I explore some of those tools: the JCreator development tool (which I explored in Part 1), the InstallAnywhere installation tool (which I will explore in Part 3), and the Jtest testing tool (which I explore this month). Before exploring Jtest, I introduce testing in a Java context.

Read the whole series on non-SDK tools, "Tools of the Trade:"



Test Java programs

Test! Test! Test! I cannot overemphasize the importance of testing Java code for defects prior to deployment. Your reputation as a software developer depends upon your code's quality.

Testing is the analysis of source/executable code and the controlled execution of executable code to reveal defects that compromise a Java program's executable integrity. Defects often lead to erratic behavior or the premature termination of an executing program. Testing divides into static analysis and dynamic analysis:

  • Static analysis: compares a program's source code and executable code with proper coding rules. Any deviation from those rules suggests a potential defect. For example, where a Java string comparison occurs in source code, does that comparison use the == operator (which is incorrect, unless the strings being compared are interned) or public boolean equals(Object o) and various String comparison methods (which usually is the correct approach)? A second example: Are nonoverridden methods declared final—to allow for compiler optimization and to enhance documentation?
  • Dynamic analysis: feeds a variety of inputs to the program as it executes. For each input, dynamic analysis determines if the output is correct. Any incorrect output (or even a program crash) suggests an executable code defect originating from a source code defect.


You can statically and dynamically test your Java programs either manually or via a testing tool that automates testing. Good testing tools have the advantage over manual testing because they do not experience human fatigue or boredom, and are more likely to generate test cases, sets of input data for a program to process, that catch hidden defects. One excellent Java-oriented testing tool is Jtest.

What is Jtest?

Parasoft's Jtest testing tool lets you statically and dynamically analyze your Java code. Jtest completely automates testing, although you can customize testing by creating your own test cases and stubs, stripped-down methods that execute code to support testing instead of their own tasks.

  • Print
  • Feedback

Resources