Automatic generation of unit tests for Java? [closed]

Commercial tools:

  • AgitarOne seems to be the biggest player in the field. There exists also 30-day trial and free web interface called JUnit Factory. There's an independent review of the tool usage in here, for example. Test generation of AgitarOne heavily focuses on the regression tests.
  • Jtest is another big player, which has been around since 1998. A free trial exists. Both AgitarOne and Jtest have been awarded multiple times, and they are both Eclipse-based IDE:s.
  • SilverMark Test Mentor, Java Edition is a commercial product that apparently can also create tests based on java code. This product I have no experience with.

Free tools:

  • CodePlex AnalytiX used to be a commercial tool (it was the first commercial plugin for Eclipse back in 2001), but since Google bought the company developing it, the product has been released as free. It's a full IDE based on Eclipse and a finalist of Jolt Award in test generation at 2007. The features are nice, but the tool hasn't been updated in long time, so it unfortunately doesn't work with current versions of eclipse, and seems to have problems with code requiring java >= 1.5.
  • EvoSuite is a a winner of SBST (Search-Based Software Testing) '13 unit test generation competition as well as SBST '17 unit test generation competition. There exists an Eclipse plugin, web interface and command line version of the tool. There is a regression criteria documented, but apparently it doesn't work yet - the tests generated target for branch coverage, weak mutation coverage or strong mutation coverage.
  • Randoop uses feedback-directed random test generation approach. The tool has been around since 2007 and has been in continuous development. Randoop can produce both regression tests and error-finding tests. It's a robust and reliable command line tool, and Eclipse plugin exists as well.
  • Palus claims to use both dynamic and static analysis, and is building on top of Randoop. Its authors claim that it has been used internally at Google. My experience with this software is that at least the current version (0.2) seems to have some internal issues and it doesn't seem to scale up well.
  • Daikon, Eclat, Javalanche, Java PathFinder, JCrasher, jWalk, Korat, RecGen and ReCrash are free tools that are available as well.

Note that tests generated by Jtest and AgitarOne both depend on licenced runners and they can't be run if you don't have their plugins integrated. This is not the case for free tools I've tested, which generate independent tests.

Disclaimer: I'm not affiliated with any of these tools but I have done academic research on the subject.


  • CodePro Analytix has a JUnit test generation module that sounds like it will do what you want. See the User Guide.
  • [CoView] was a reasonably priced product, at only $9.99 per user per year, unfortunately it doesn’t exist anymore.
  • AgitarOne Automated JUnit Generation is worth investigating.

All three products have a try before you buy option, so you could use them to compare the generated code against a small subset of your application.


NetBeans does it automatically from Java source files (I guess the other IDEs too).

Maybe you could take a look into the junit plugin (link is currently down :-()?


Netbeans 8 has a built-in capability to build unit tests that are more than stubs. To use this feature:

  1. Open the class you want to test.
  2. Select Create/Update Tests from the Tools menu.
  3. Select whatever features you want.
  4. Open the created unit test and finish the remaining parts of the test.