Static Analysis

Subscribe to Static Analysis: eMailAlertsEmail Alerts newslettersWeekly Newsletters
Get Static Analysis: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn

Static Analysis Authors: AppDynamics Blog, Jason Bloomberg, RealWire News Distribution, Skytap Blog, Jayaram Krishnaswamy

Related Topics: Java Developer Magazine, Static Analysis

Java Developer : Article

Jtest! by ParaSoft

Jtest! by ParaSoft

ParaSoft's Jtest 3.0 is a powerful automated tool for testing Java classes. Developers can unit-test their code for completeness and standards compliance and conduct regression tests to ensure that changes they've made to their code haven't introduced errors.

I installed Jtest on an IBM Thinkpad 600E running Windows NT 4.0 Workstation, Service Pack 5, with 128MB of RAM. According to Jtest's documentation, it'll run on Windows NT/95/98, with support for Solaris and Linux coming in the next few releases. Minimally, Jtest recommends you run with a Pentium 233 with 128MB of RAM. It also now supports Java Development Kit version 1.1.x and version 1.2. One of these JDKs must be in your path in order to perform all of the tests available.

Installation was simple; within minutes I was able to execute tests using the demo class installed with the application. The installation comes with a well-written tutorial that explains in easy-to-follow terms all of Jtest's features. That said, the application still relies on clumsy message boxes to explain what the application is doing and what the user may do next. Thankfully, these messages can be turned off.

Static Analysis
Performing code reviews is a part of any successful project. These reviews can catch many logic errors as well as ensure adherence to standards. Jtest performs these reviews by analyzing your code and comparing it to a set of rules. The user can customize these rules by clicking the Global button, opening the Static Analysis node, opening the Rules node and then opening the Built-in Rules node. From here you can enable or disable specific rules or entire rule categories by their severity levels.

White Box Testing
Anyone who has survived a long testing project knows that one of the most tedious processes is writing test cases. Jtest is the first testing application that generates unit test cases based on the internal structure of your classes. Using patented technology, Jtest examines bytecode, trying to break the class by attempting to pass unexpected variables to its methods.

To begin white box testing, open Jtest and browse to the class you'd like to test. To test multiple classes, go to the Project Testing UI and select the directory, zip or jar file of classes. After this is completed, press the start button and wait for Jtest to conduct its tests.

Once the test is completed, Jtest will display the list of errors it generated. Right clicking on any of these errors will allow you to view the code on which the error was generated. This error can also be suppressed in the future if, for example, you know that a null would never be passed into these methods.

Black Box/Regression Testing
Black box testing checks to see whether the class is behaving according to its specification. During a normal testing phase, these test cases would have to be written by poring through written specifications and compiling combinations of possible inputs. Jtest provides these inputs for you and tests all possible combinations.

After running your first test on the class, you can view which inputs Jtest used and add any custom ones you think are necessary by selecting the View Test Cases button. After all the necessary test cases have been run, you can validate the output.

This validated output will serve as a baseline every time Jtest is run on the class and will perform regression testing by ensuring that any changes made to the class since the last test haven't changed these outcomes.

Jtest is unique in its ability to generate testing inputs and will save any development project a significant amount of time. Its automated execution of both white and black boxes sets it apart as a testing tool. Its testing should strengthen your project's code and allow developers to spend more time on coding and less time writing test cases. Jtest's only drawback is its price, which still remains slightly high at nearly $3,500 per seat.

More Stories By Jennifer Nestor

Jennifer Nestor, a staff consultant with Computer Sciences Corporation, has been programming in Java for over two years. She has a BA in mathematics and is currently pursuing an MBA.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.