Agitar Puts Java to the Test

Q&A: CEO Jerry Rudisin looks to make it easier to get the code right.

As enterprise applications continue to grow more and more complex, the need for testing and quality assurance tools increases more than ever. Agitar Software, based in Mountain View, Calif., specializes in the automation of unit testing, where software developers test their code as they write it. Jerry Rudisin, CEO and president of Agitar, chatted with eWEEK Senior Editor Darryl K. Taft about the importance of testing and how it can help improve software quality and business agility.

What is unit testing?

Its the practice in which software developers test each module of their code in isolation—hence the term "unit"—as they write it and deliver their code with a set of tests that characterize and validate the correct behavior of individual modules.

The important point is that code needs tests to do the best job of getting it right and keeping it right. If you create tests as you write the code, you create better code. Its easier to get the code right in the first place. And you can develop [applications] faster, since you spend less time on the pursuit of bad design paths, wandering around in a debugger to see what the code is doing, and on software scrap-and-rework.

If you have a good set of tests that characterize each modules behavior, its much easier to safely change it later. You can see right away if a change to one behavior breaks another behavior—a likely source of bugs.

Unit testing is an old idea, though its popularity has soared in the past five years. Open-source frameworks such as JUnit [for Java] and NUnit [for .Net], have encouraged unit testing by providing a standard way to express tests. Unit testing is the best way to improve the economics of software development and the agility of development teams.

Some organizations try unit testing and end up with some small percentage of developers who are test-infected—they find it natural to create unit tests and see the benefits. But most teams stay test-neglected—the developers try unit testing and back off because they find it too hard. Its more important to have unit tests than to practice unit testing. The question is then one of, how can the test-neglected get unit tests on their code, and how can the test-infected practice more thorough unit testing with less manual effort?

Whats the benefit of unit testing over other types of testing?

Unit testing is all about building in quality instead of testing out bugs, by making sure that each code module does what its supposed to do. It minimizes bugs by exposing defects early and isolating the guilty module quickly, and by making it easier to safely change code [both new code and legacy systems]. Every bug thats prevented or fixed while in development is one less bug that gets in the way of the GUI, functional, performance or stress testing that QA [quality assurance] teams do.

Many QA teams complain of getting junk from development. Giving QA code that has good unit tests lets the QA team focus on integration and real system-level testing, since it spends less time finding and isolating bugs long after theyre introduced. Code with unit tests helps development teams release software systems that work a lot faster. Theres a real advantage to unit testing both in quality and time to market.

What does Agitar do differently [from competitors], or what makes it unique?

Agitars flagship product, AgitarOne, is a comprehensive server-based solution for unit testing of Java code. AgitarOne is powered by Agitator, an award-winning innovation that performs unique dynamic and static analysis on the code. Agitator executes many pathways through the code and identifies interesting observations about what the code does in the face of normal and exceptional conditions, including many that a developer might not think of or might find too tedious to analyze. Developers can use Agitator to interactively examine these observations and promote them to regression tests or tell AgitarOne to publish them in the form of standard JUnit tests.

Why should a developer use Agitars tools instead of JUnit, which is free?

About 95 percent of Agitar customers start with JUnit and continue to use it even after they use AgitarOne. This is true of Agitar as well. Our code has a huge set of Agitator assertions and JUnit tests, and we check them 24/7 using continuous integration and testing. But if your organization uses JUnit, AgitarOne is a perfect fit.

Some developers happily spend time writing unit tests. JUnit is just more code to write and to maintain. But testing is a combinatorial problem that cries out for automation. Even if you could write and maintain extensive unit tests by hand, why would you do it when a computer can do it faster? And, of course, people cannot easily think of all of the boundary conditions and corner cases for which they should test, so automation is needed to be really thorough.

And for the test-neglected shops or where theres a lot of never-been-unit-tested legacy code, automation is the easiest way to get started. You can use AgitarOne to create a set of JUnit tests that characterize the current behavior of your software. You get a set of regression tests that let you know when you change some behavior by accident.

There is far too much Java code without unit tests, because manual unit testing is too hard. AgitarOne provides automation that leverages the intellectual power of a talented human by doing a lot of the grunt work.

What kind of overhead does Agitars technology bring into the development experience—in terms of time, resources, extra work or complexity?

Even though the benefits are clear, many developers see unit testing as a behavior change to be resisted. AgitarOne is designed to make it as easy as possible to get a good set of unit tests and to augment or amplify the unit testing that good developers already do.

You can install the AgitarOne Eclipse plug-in for generating JUnit, point to a Java project, press a button to send the Java code to the AgitarOne server and get JUnit tests. You can literally start to generate good characterization tests in minutes. You can look at them to learn about the behavior of your code, or check them in and look at them only when they fail in the face of a later change to the code.

You can write JUnit tests, of course. And you can improve the thoroughness of the generated tests and your handcrafted tests by writing a few simple helper methods that tell AgitarOne how to create objects that your code needs. Other AgitarOne clients support interactive exploratory testing, code-rule checking, and dashboard reports on test thoroughness and trends.

Does Agitar help developers create more secure code?

A lot of security flaws stem from unexpected or undocumented code behavior, and many of these unexpected "what if?" situations are discovered and highlighted by AgitarOne. AgitarOne also provides code-rule enforcement, making it easy for organizations to identify and avoid dangerous coding patterns.

AgitarOne complements the static analysis tools that scan code for known security flaws. As with software quality, maximum software security is best achieved by combining multiple techniques for defense in depth, starting with delivering individual software unit classes and methods in the case of Java that are validated to be free of flaws that could be exploited to allow security problems.

How has your experience as a former Rational [now IBM Rational] exec helped prepare you for your role at Agitar?

Everyone who helped build Rational is quite proud of what that company achieved over its 23 years as an independent company. I joined the old private Rational when it had completed a year with revenues of about $28 million, and left when it had completed a year with revenues of $412 million, so I experienced tremendous growth. Agitar isnt that big yet, but we aspire to be.

Rational enabled a real change for the better in worldwide software development practices. It did more than any other organization to popularize iterative development approaches, which are a lot more effective than the old pure waterfall approaches. It did it by relentless focus on its mission, sustained innovation, a zeal for customer satisfaction and by fostering a high-trust, high-performance culture. This worked very well and is a very good model of what one can do when tackling a hard problem with very innovative and dedicated people.


Check out eWEEK.coms for the latest news, reviews and analysis in programming environments and developer tools.