views:

1080

answers:

3

Are there any libraries for Java that can generate unit tests or unit test skeletons for existing code? I'm looking for something similar to pythoscope. Ideally it would generate code that follows JUnit4 or TestNG conventions.

It looks like Agitar does something like this, but I'm looking for something free.

A: 

Agitar had a free service that allowed you to do this (you had to be prepared to let it send your code to their servers).

If you were using scala, there is "scala check" - but I am not sure how well it works with java source (even though its all byte code).

Michael Neale
Sadly that's unacceptable for my uses (proprietary code)
Ryan
+1  A: 

Most IDEs will generate test method stubs for any class. I know Eclipse will.

New->JUnit Class then you tell it which class you're testing and what methods you want to test.

Matt
A: 

I've been trying to get TestGen4j running but it looks like it hasn't been maintained :( Perhaps you give that a try?

CodePolice