Archive for July 6th, 2007

Begin to evaluate some automatic unit test tools

Friday, July 6th, 2007

Unit test is great for developing solid codes, however, unfortunately there are some legacy projects with bunch of workable codes but no single line unit tests after all, when we try to refactor those legacy codes, we will face the problem that we don’t have unit tests and the refactoring works may depends on. Of course we can create some unit test for those legacy codes, but that’s really boring, I am looking for some tools which can generate some unit test codes for me automatically.

AgitarOne

Looks very promising , I applied for a trail version and still wait for their response. So I can say nothing more on it…

AgitarOne provides powerful automation capabilities that can help you detect regressions, avoid preventable defects, and ensure quality as you modify your code. With AgitarOne, you can:

  • Quickly and easily generate JUnit tests with AgitarOne’s automated JUnit generation capabilities
  • Create a change-detection “safety net” of JUnit regression tests for Java applications that lack tests, so that you can change them with confidence
  • Agitate your software to interactively explore the behavior of your new code and find unexpected behavior
  • Use code-rule enforcement to help you find and remove bug-prone anti-patterns
  • Get meaningful JUnit tests and agitation results for an entire team in a matter of minutes, through AgitarOne’s server-based deployment model
  • Get full visibility into the status and trends of your unit-testing activities through AgitarOne’s comprehensive dashboard

AgitarOne provides support for J2EE, Struts, Spring, Hibernate, and other common Java frameworks, and is compatible with any Eclipse-based IDE.

Fortunately the do provide a free online service, JUnitFactory seemed use the same engine as AgitarOne.

JUnitFactory

This is an online service by Agitar. As it said “You send us code. We send you tests”. There is a web page to submit code and then get the generated unit test. But this web interface is just for simple demo, to use it create unit tests for comprehensive projects will need to install eclipse plugin.

With an Eclipse plugin, it’s very easy to use it generate unit tests for very large projects. ( I tried an open source project with over 2000 source files)

JunitFactory will upload all of your project codes to their web site, include source code and all dependencies…which seemed not really useful for most of company.

The generated code is not quite readable, and it’s heavily depends on some bases classes of Agitar, and can’t run directly with JUnit.

TestGen
TestGen is a collection of open-source tools that automatically generates unit test cases. The first released component of TestGen is TestGen4J. TestGen4J automatically generates JUnit test cases from your own Java class files, or source files. Its primary focus is to exercise boundary value testing of the arguments passed to the method. It uses rules, written in a user-configurable XML file, that defines boundary conditions for the data types. The test code is separated from test data with the help of JTestCase.

Flowchart.gif

Any more? 

Will wrote a detail report later on those tools….

Popularity: 7% [?]

Close
E-mail It
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License.