JUnitDoclet - not (yet) a plugin, but useful

JUnitDoclet is helping you with the repeating tasks of writing JUnit tests.

Basically JUnitDoclet is generating and maintaining TestCases and TestSuites based on your application source. And it is helping to keep these tests in sync during development, especially after refactoring (renaming, moving, ...)!

No tests get lost!

You'll notice that you don't get interrupted by "trying to remember the syntax of a test case" when you are working with it for a while. Because is much less work (or pain ?) to write a test, you'll see yourself writing more tests. That tends to be a good thing.

For public accessor methods (like getValue/setValue or setFlag/isFlag), a combined default test is generated based on the type accessed. Of course you can modify that test and your modifications will remain when re-generating.

Using JUnitDoclet, you stay in control. The generated code is based on templates, just adapt them if necessary.

There is no need to outsmart JUnitDoclet. This tool is standing at your side, not in your way. This means: It does not do it all, it's "just" helping as much as it can. You decide everything else.

For details please see:

http://www.intellij.org/twiki/bin/view/Main/JUnitDoclet (which points you to) http://www.junitdoclet.org/

Working as a Doclet all it needs is JavaDoc, maybe as an ANT target. This way it is working with IDEA 2.x as well. But we think about making it a IDEA-Plugin too. Please send any suggestions about the plugin idea to junitdoclet@objectfab.de .

Regards,

Steffen Gemkow

BTW: We developed JUnitDoclet using IDEA 2.6 and the EAP versions. Great tool, getting even better!

11 comments
Comment actions Permalink

JUnitDoclet 1.0.1 now includes an example, how to install it as external tool in IDEA which is
working for version 2.6 and Ariadna.

The (re)generation of TestCases and TestSuites is only a click/keystroke away. I hope you like that.

Please visit http://www.junitdoclet.org/ for more information.

Regards,

Steffen

0
Comment actions Permalink

JUnitDoclet 1.0.2 released

It's mainly about bugfixes and documentation
(especially for use with IDEA 3.0).
Updating is recommended.

Sorry it took so long.

BTW: How do you like JUnitDoclet? Any suggestions?

Regards,

Steffen

http://www.junitdoclet.org/

0
Comment actions Permalink

OK, I've been trying to get this to work as an external tool, and I just can't get it. Here is my setup:

I made a bin directory (C:\Java\JUnitDoclet.1.0.2\bin) and put the JUnitDoclet.jar, packagelister.jar, and 3 batch files (run_junitdoclet_setenv, run_junitdoclet, run_junitdoclet_recursive) in that directory. Then I put that bin directory in IntelliJ's classpath.

My setenv file looks like:

When I right-click and try to run, I get an error message (see attachment). What am I doing wrong?

Also, what is the packages.txt for? Do I need to put something in that file? Thanks for the help!

Tobin



Attachment(s):
error_msg.bmp
0
Comment actions Permalink

Tobin,

please put that bin directory to your path, not to the classpath. It is about executing *.bat files, so they can handle of all the parameters of JUnitDoclet for you.

The packages.txt will be generated, you don't need to deal with it. (javadoc 1.3 didn't have an option to scan sub packages. If you are using 1.4 only, you could adapt that part.)

With the setting you've statet, JUnitdoclet will generate TestCases and Testsuites to a directory "./junit" below your project home (in your case: C:\Java\projects\wells\junit). Please make sure, it is existing. You should declare that directory as part of your projects source path.

When your editor shows a source file, click right and you'll see "JUnitDoclet -> Generate TestCase" and "JUnitDoclet -> Generate TestSuite and sub tests" at the bottom of the menu.

You can use this menu from tree view as well. Please note, it does not work on directories, just on files.
(If someone knows how to disable external tools in
project view on directories...)

I hope this is helping you and you are going to like JUnitdoclet. Please let me know.

If I can be of further assistance, ...

Kind Regards,

Steffen

0
Comment actions Permalink

Ok, I'm getting closer. The junit directory existed, but it wasn't in my sourcepath. I added that to my sourcepath, and then added C:\Java\JUnitDoclet.1.0.2\bin to my path (not classpath). Now when I try to run it, I am getting "Cannot start process, the working directory does not exist". What do I do from here? What exactly is the working directory? Thanks for your help!

Tobin

0
Comment actions Permalink

The working directory is where IDEA starts an external program in. Please see IDEA docs for more.

The working directory is set to your project path by using the macro $Projectpath$.

If that (for whatever reason) is not working for you, please change it in the configuration (see external tool) to the path you are using.

If you still don't get things going, please describe your problem in more detail. (IDEA version, full error message, current settings, project topology, ...)

Regards,

Steffen

0
Comment actions Permalink

Whew. I was finally to get it working by replacing the line

]]>

with the line

0
Comment actions Permalink

Whew. I was finally to get it working by replacing the line

]]>

with the line

]]>

(my project path)

Does this mean that IntelliJ is not populating the right value in the $Projectpath$ variable? Should someone follow up on this?

Anyways, thanks for all your help getting it running. I appreciate it.

Tobin

0
Comment actions Permalink

The classpath-parameter for our project were that long,
that WINNT created an error while passing the arguments.
My workaroud was to create a seperated java-client.
Perhaps it is a first step for an IDEA-plugin?

see atached files:
JUnitDoclet2TestCaseClient replaces run_junitdoclet.bat
JUnitDoclet2TestSuiteClient replaces run_junitdoclet_recursive.bat
JUnitDoclet.xml is my external-tool-connection to IDEA

You have to adapt your paths.



Attachment(s):
JUnitDoclet2TestSuiteClient.java
JUnitDoclet.xml
0
Comment actions Permalink

Holger,

maybe I don't see all the details, but to me it seems like your suggestion is: Call a Java program that in turn calls javadoc (another Java program).

This may be working, but it does not sound like fun. (You fire up one JVM with the other... Is that close to interactive? ;) )

I suggest you look out for some NT docs. Modify your personal copies of the batch files if you need to.

Did you try to call JUnitDoclet from ANT? (It does not have to be an external tool, you know...) Programming has to be fun. Please don't slow down your working environment like I think you do. (I hope I'm wrong.)

Regards,

Steffen Gemkow

0
Comment actions Permalink

Hi,
I think I am having the same problem as Holger.
I believe I successfully installed JUnitDoclet but when I choose a java file and select generate test I get:

The input line is too long.
The syntax of the command is incorrect.
External tool 'Generate TestCase' completed with exit code 255

Sadly I am on Windows 2K. The command that is failing is pasted below.

Does anyone know a good work around for this?

Thanks, Spencer

run_junitdoclet.bat src\com\lm\lmig\sam\assignment3\SenderOfMessages.java C:\sam\sandbox\gigaspaces\src -buildall "C:\sam\sandbox\gigaspaces\build;C:\GigaSpaces2.1\lib\activation.jar;C:\GigaSpaces2.1\lib\cloudscape.jar;C:\GigaSpaces2.1\lib\create-dl.jar;C:\GigaSpaces2.1\lib\create.jar;C:\GigaSpaces2.1\lib\destroy.jar;C:\GigaSpaces2.1\lib\GigaRayTrace-dl.jar;C:\GigaSpaces2.1\lib\GigaSpaces-ext-dl.jar;C:\GigaSpaces2.1\lib\GigaSpaces-ext.jar;C:\GigaSpaces2.1\lib\jini-core.jar;C:\GigaSpaces2.1\lib\jini-examples-dl.jar;C:\GigaSpaces2.1\lib\jini-examples.jar;C:\GigaSpaces2.1\lib\jini-ext.jar;C:\GigaSpaces2.1\lib\jndi.jar;C:\GigaSpaces2.1\lib\JSpaces-dl.jar;C:\GigaSpaces2.1\lib\JSpaces.jar;C:\GigaSpaces2.1\lib\mahalo-dl.jar;C:\GigaSpaces2.1\lib\providerutil.jar;C:\GigaSpaces2.1\lib\reggie-dl.jar;C:\GigaSpaces2.1\lib\reggie.jar;C:\GigaSpaces2.1\lib\rmiregistry.jar;C:\GigaSpaces2.1\lib\sharedvm.jar;C:\GigaSpaces2.1\lib\ext\bootstrap.jar;C:\GigaSpaces2.1\lib\ext\catalina.jar;C:\GigaSpaces2.1\lib\ext\commons-beanutils.jar;C:\GigaSpaces2.1\lib\ext\commons-collections.jar;C:\GigaSpaces2.1\lib\ext\commons-digester.jar;C:\GigaSpaces2.1\lib\ext\CustomSecurityFilter.jar;C:\GigaSpaces2.1\lib\ext\ibmjsse.jar;C:\GigaSpaces2.1\lib\ext\jasper-compiler.jar;C:\GigaSpaces2.1\lib\ext\jasper-runtime.jar;C:\GigaSpaces2.1\lib\ext\jsse.jar;C:\GigaSpaces2.1\lib\ext\mail.jar;C:\GigaSpaces2.1\lib\ext\naming-common.jar;C:\GigaSpaces2.1\lib\ext\naming-factory.jar;C:\GigaSpaces2.1\lib\ext\naming-resources.jar;C:\GigaSpaces2.1\lib\ext\servlet.jar;C:\GigaSpaces2.1\lib\ext\servlets-common.jar;C:\GigaSpaces2.1\lib\ext\servlets-default.jar;C:\GigaSpaces2.1\lib\ext\soap.jar;C:\GigaSpaces2.1\lib\ext\uddi4j.jar;C:\GigaSpaces2.1\lib\ext\warp.jar;C:\GigaSpaces2.1\lib\ext\wsdl4j.jar;C:\GigaSpaces2.1\lib\ext\wstk.jar;C:\GigaSpaces2.1\lib\ext\xerces.jar;C:\sam\j2sdk1.4.1_01\jre\lib\charsets.jar;C:\sam\j2sdk1.4.1_01\jre\lib\jaws.jar;C:\sam\j2sdk1.4.1_01\jre\lib\jce.jar;C:\sam\j2sdk1.4.1_01\jre\lib\jsse.jar;C:\sam\j2sdk1.4.1_01\jre\lib\rt.jar;C:\sam\j2sdk1.4.1_01\jre\lib\sunrsasign.jar;C:\sam\j2sdk1.4.1_01\jre\lib\ext\dnsns.jar;C:\sam\j2sdk1.4.1_01\jre\lib\ext\ldapsec.jar;C:\sam\j2sdk1.4.1_01\jre\lib\ext\localedata.jar;C:\sam\j2sdk1.4.1_01\jre\lib\ext\sunjce_provider.jar;C:\sam\sandbox\gigaspaces\lib\junit.jar;C:\GigaSpaces2.1\lib\mahalo.jar" C:\sam\j2sdk1.4.1_01
The input line is too long.
The syntax of the command is incorrect.
External tool 'Generate TestCase' completed with exit code 255

0

Please sign in to leave a comment.