ObjectFab GmbH - Logo JunitDoclet - Logo


Easy to use
JUnitDoclet is to be used with javadoc, which offers a known interface and much support from integrating tools (like ANT).
Supporting but no know-all
JUnitDoclet is not a wizard, it may even delegate some decisions to you, since you know better what to do. It is standing at your side, not in your way.
For each public method of each public class a test method is generated. Bodies of such test methods are empty most of the time. You write the tests but don't have to bother with all the monkey work.
Your modifications remain when regenerating.
Accessor tests for free
For accessor methods such as set* , get* or is* combined test methods like testSetGet* and testSetIs* are generated with a type specific default implementation.
For generating TestSuites and TestCases the template approach allows easy customization. Since release 1.6, there are ready-to-use templates for JUnit 3.8 and JUnit 4.X included.
System variables in templates
System properties (like user.name) are available as variables in templates.
Separation of tests and application
Tests can be generated
  • to a separate source tree for tests (see demo) or
  • to sub packages in the main source tree (often they are called "test").
The output to the source tree is possible but not recommended.
Extendable tests
It's easy to add your own test methods, TestCases and TestSuites as well. They will remain when re-generating as well.
TestCases and TestSuites contain a main method to call this test with TestRunner from TextUI.
Can be used with custom test extensions
TestCases can inherit from subclasses of junit.framework.TestCase. (Modify that once per file, it will be kept from that point on. Or modify the template.)
Refactoring support
Bodies of test methods which do not find a match when regenerating (tests for renamed or deleted methods) are collected in a special test method. If this special test method is not empty JUnitDoclet will report a warning.
Supports javadoc comments in TestCases
For each test method a javadoc comment can be preserved. It can be generated as well. By default this feature is turned off. (There are different opinions about generated documentation. ;-) If you go for it, there is a prepared template just for you.)
Smart regenerating
Generation only if source file changed. And if the re-generated TestCase/TestSuite equals the current file, it won't be rewritten. (This is helpful to synchronize with CVS.)
Cares for tests prior to JUnitDoclet
TestCases or TestSuites which aren't generated by JUnitDoclet won't be overwritten. (If files don't have all the markers, it may be a test file prior to JUnitDoclet. JUnitDoclet prints a warning but doesn't overwrite.)