In-Depth

Agitar Unveils Improved Java Test App

Agitar has rolled out a new version of a Java code-testing solution that helps programmers handle perhaps the dirtiest job of all -- dealing with legacy code. The new app, AgitarOne 4.2, promises "80 percent project code coverage out of the box," according to the company's announcement. For those wondering about the other 20 percent, much of it is unreachable due to software complexity.

"Sometimes the logic is so complicated … and then it becomes like a game of chess where you can only look so deep into the code because there are so many branches and possibilities," explained Alberto Savoia, Agitar's chief technology officer and founder.

AgitarOne generates characterization tests, which actually execute the legacy code and record the behavior of the code. When a software developer makes a change to the legacy code, Agitar's solution flags any differences in the application's behavior.

The point of such testing is to ensure that the legacy code doesn’t get broken when altering it, Savoia said.

"When you are dealing with legacy code, the most important thing is to make sure that when you go and make changes, you don't break existing behavior unintentionally," he explained, citing a principle from the book, "Working Effectively With Legacy Code" by Michael Feathers.

Savoia founded Agitar to meet his customers' worst problems. For developers, dealing with legacy code is "the software equivalent of cleaning out asbestos," he said. The legacy code continues to meet new business requirements, but there needs to be a way to make changes and test the code without breaking the application. AgitarOne automatically generates Java unit tests (JUnits) to speed the process.

"Our AgitarOne server can generate as many as 250,000 lines of JUnits in an hour," he said. "It's equivalent to having 1,000 developers writing code for you."

Without an automated approach, JUnit test writing is a laborious process. For every line of code you write, typically you have to write three or four lines of test code to exercise all of the tests, Savoia explained, which is why people don't do more unit testing.

"Using our technology, you end up writing one line of test code for every four lines of code," he explained.

The need for more JUnit testing derives from the demands of agile software development, where smaller teams perform frequent software builds. It's a huge shift from the traditional waterfall model development approach because code is now being released on a continuous basis, Savoia explained.

"Ten years ago, about less than one percent of developers would even think of doing unit testing," Savoia said. "You couldn't find a book on unit testing. Very few people did it and people thought it was weird, including me. Clearly, though, that was the wrong thing to do. We were being very lazy. What has happened now with extreme programming and other Java development, is that people realize you cannot be agile if you don't have tests. Agility means you must be able to make changes. But it's hard to make changes and not break anything in software. And the way that you prevent that is if you have tests."

Currently, Savoia estimates that about 20 percent to 30 percent of organizations take unit testing very seriously, but he expects that to change.

"Today, we're at the beginning of a unit testing revolution," he said. "My mission with Agitar is to make sure that developer testing becomes the norm, rather than the minority or the exception, and I think we are well on our way."

AgitarOne is Eclipse-compliant, and works with Borland products and other integrated development environments. The product is also open source friendly. Anybody working in open source in academia has free access to Agitar's technology, Savoia said.

About the Author

Kurt Mackie is senior news producer for 1105 Media's Converge360 group.