I'm trying to use the plugin to generate testcases for several packages. So I tried first to user it for one class, no problems/warnings. A package test ist created, and as a subpackage the package where the original class is in.
Now, when I try for a whole package, I get following console output (with '-verbose' option):
[search path for source files: []]
[search path for class files: [D:\Programme\Java\jdk1.5.0_04\jre\lib\rt.jar, D:\Programme\Java\jdk1.5.0_04\jre\lib\jsse.jar, D:\Programme\Java\jdk1.5.0_04\jre\lib\jce.jar, D:\Programme\Java\jdk1.5.0_04\jre\lib\charsets.jar]]
Loading source files for package fsjutil...
Constructing Javadoc information...
Generating TestSuites and TestCases.
[done in 1963 ms]
2 warnings
But the only thing that's actually done, is that the test package is created, nothing more. So I took a look at the eclipse error.log showing:
!ENTRY net.sourceforge.eclipse.junitdoclet 2 0 Sep 22, 2005 08:07:23.750
!MESSAGE Unable to get and set the classpath entries from the project prismAVisor
!STACK 1
Java Model Exception: Java Model Status [Cannot nest 'prismAVisor/test' inside 'prismAVisor'. To enable the nesting exclude 'test/' from 'prismAVisor']
at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:735)
at org.eclipse.jdt.internal.core.JavaProject.setRawClasspath(JavaProject.java:2658)
at org.eclipse.jdt.internal.core.JavaProject.setRawClasspath(JavaProject.java:2674)
at net.sourceforge.eclipse.junitdoclet.popup.actions.JUnitDocletAction.retrieveCodeGenerationOutputPath(JUnitDocletAction.java:494)
at net.sourceforge.eclipse.junitdoclet.popup.actions.JUnitDocletAction.generateJUnitDocletCommand(JUnitDocletAction.java:368)
at net.sourceforge.eclipse.junitdoclet.popup.actions.JUnitDocletAction.access$0(JUnitDocletAction.java:343)
at net.sourceforge.eclipse.junitdoclet.popup.actions.JUnitDocletAction$1.run(JUnitDocletAction.java:128)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:66)
!SUBENTRY 1 org.eclipse.jdt.core 4 964 Sep 22, 2005 08:07:23.750
!MESSAGE Cannot nest 'prismAVisor/test' inside 'prismAVisor'. To enable the nesting exclude 'test/' from 'prismAVisor'
!ENTRY net.sourceforge.eclipse.junitdoclet 2 0 Sep 22, 2005 08:19:43.233
!MESSAGE Unable to get and set the classpath entries from the project prismAVisor
!STACK 1
Java Model Exception: Java Model Status [Cannot nest 'prismAVisor/test' inside 'MyApp'. To enable the nesting exclude 'test/' from 'MyApp']
at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:735)
at org.eclipse.jdt.internal.core.JavaProject.setRawClasspath(JavaProject.java:2658)
at org.eclipse.jdt.internal.core.JavaProject.setRawClasspath(JavaProject.java:2674)
at net.sourceforge.eclipse.junitdoclet.popup.actions.JUnitDocletAction.retrieveCodeGenerationOutputPath(JUnitDocletAction.java:494)
at net.sourceforge.eclipse.junitdoclet.popup.actions.JUnitDocletAction.generateJUnitDocletCommand(JUnitDocletAction.java:368)
at net.sourceforge.eclipse.junitdoclet.popup.actions.JUnitDocletAction.access$0(JUnitDocletAction.java:343)
at net.sourceforge.eclipse.junitdoclet.popup.actions.JUnitDocletAction$1.run(JUnitDocletAction.java:128)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:66)
!SUBENTRY 1 org.eclipse.jdt.core 4 964 Sep 22, 2005 08:19:43.274
!MESSAGE Cannot nest 'MyApp/test' inside 'MyApp'. To enable the nesting exclude 'test/' from 'MyApp'
So I tried to exclude the test/ in several ways:
- Project -> Properties -> Java Build Path -> MyApp -> Excluded: added test/ there
- '-exclude test/' option as command-line parameter
- '-extdirs test/' option as command-line parameter
and also every combination of those above possible, I think.
I also tried to include junitdoclet with batch-files and although the configuration is kind of tricky, I managed to create my testcases and testsuites for a whole pacakge.
Have an idea what is wrong?
Regards
Shiggy
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
this seems like you have your Java source files at the root of your project, instead of having separate source and output folders. This is a Best Practice to have separate source and output folders, and that's why the plugin was developed in regards of this.
So basically, you should have a structure like this:
MyProject/
+ src/
+ bin/
And the JunitDoclet plugin will create another source folder, so you will end up with:
MyProject/
+ src/
+ bin/
+ test/
Please tell me if this solves your problem, so that I put that in the doco (and/or I add the possibility to use the root of the project as the source folder) for the next release.
HTH,
Regards,
Fabrice.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
you were right, that really solved the problem! Thank you very much.
Another question, just because I'm interested: while the plugin didn't work (for me), I tried to run it with Eclipse and ant, but as I'm new to ant, I had difficulties to set up a correct build.xml. So I googled for some more detailed examples than the one coming with the JunitDoclet distribution, but didn't find anything useful. Do you know where I could find such an example build file?
Regards,
Julien aka Shiggy
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well, I remember I wrote my own Ant script... Maybe you could email the JUnitDoclet guys so that they can provide you with such a build file. And even ask them to put such a file in the distrib!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I'm trying to use the plugin to generate testcases for several packages. So I tried first to user it for one class, no problems/warnings. A package test ist created, and as a subpackage the package where the original class is in.
Now, when I try for a whole package, I get following console output (with '-verbose' option):
[search path for source files: []]
[search path for class files: [D:\Programme\Java\jdk1.5.0_04\jre\lib\rt.jar, D:\Programme\Java\jdk1.5.0_04\jre\lib\jsse.jar, D:\Programme\Java\jdk1.5.0_04\jre\lib\jce.jar, D:\Programme\Java\jdk1.5.0_04\jre\lib\charsets.jar]]
Loading source files for package fsjutil...
Constructing Javadoc information...
Generating TestSuites and TestCases.
[done in 1963 ms]
2 warnings
But the only thing that's actually done, is that the test package is created, nothing more. So I took a look at the eclipse error.log showing:
!ENTRY net.sourceforge.eclipse.junitdoclet 2 0 Sep 22, 2005 08:07:23.750
!MESSAGE Unable to get and set the classpath entries from the project prismAVisor
!STACK 1
Java Model Exception: Java Model Status [Cannot nest 'prismAVisor/test' inside 'prismAVisor'. To enable the nesting exclude 'test/' from 'prismAVisor']
at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:735)
at org.eclipse.jdt.internal.core.JavaProject.setRawClasspath(JavaProject.java:2658)
at org.eclipse.jdt.internal.core.JavaProject.setRawClasspath(JavaProject.java:2674)
at net.sourceforge.eclipse.junitdoclet.popup.actions.JUnitDocletAction.retrieveCodeGenerationOutputPath(JUnitDocletAction.java:494)
at net.sourceforge.eclipse.junitdoclet.popup.actions.JUnitDocletAction.generateJUnitDocletCommand(JUnitDocletAction.java:368)
at net.sourceforge.eclipse.junitdoclet.popup.actions.JUnitDocletAction.access$0(JUnitDocletAction.java:343)
at net.sourceforge.eclipse.junitdoclet.popup.actions.JUnitDocletAction$1.run(JUnitDocletAction.java:128)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:66)
!SUBENTRY 1 org.eclipse.jdt.core 4 964 Sep 22, 2005 08:07:23.750
!MESSAGE Cannot nest 'prismAVisor/test' inside 'prismAVisor'. To enable the nesting exclude 'test/' from 'prismAVisor'
!ENTRY net.sourceforge.eclipse.junitdoclet 2 0 Sep 22, 2005 08:19:43.233
!MESSAGE Unable to get and set the classpath entries from the project prismAVisor
!STACK 1
Java Model Exception: Java Model Status [Cannot nest 'prismAVisor/test' inside 'MyApp'. To enable the nesting exclude 'test/' from 'MyApp']
at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:735)
at org.eclipse.jdt.internal.core.JavaProject.setRawClasspath(JavaProject.java:2658)
at org.eclipse.jdt.internal.core.JavaProject.setRawClasspath(JavaProject.java:2674)
at net.sourceforge.eclipse.junitdoclet.popup.actions.JUnitDocletAction.retrieveCodeGenerationOutputPath(JUnitDocletAction.java:494)
at net.sourceforge.eclipse.junitdoclet.popup.actions.JUnitDocletAction.generateJUnitDocletCommand(JUnitDocletAction.java:368)
at net.sourceforge.eclipse.junitdoclet.popup.actions.JUnitDocletAction.access$0(JUnitDocletAction.java:343)
at net.sourceforge.eclipse.junitdoclet.popup.actions.JUnitDocletAction$1.run(JUnitDocletAction.java:128)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:66)
!SUBENTRY 1 org.eclipse.jdt.core 4 964 Sep 22, 2005 08:19:43.274
!MESSAGE Cannot nest 'MyApp/test' inside 'MyApp'. To enable the nesting exclude 'test/' from 'MyApp'
So I tried to exclude the test/ in several ways:
- Project -> Properties -> Java Build Path -> MyApp -> Excluded: added test/ there
- '-exclude test/' option as command-line parameter
- '-extdirs test/' option as command-line parameter
and also every combination of those above possible, I think.
I also tried to include junitdoclet with batch-files and although the configuration is kind of tricky, I managed to create my testcases and testsuites for a whole pacakge.
Have an idea what is wrong?
Regards
Shiggy
Hi Shiggy,
this seems like you have your Java source files at the root of your project, instead of having separate source and output folders. This is a Best Practice to have separate source and output folders, and that's why the plugin was developed in regards of this.
So basically, you should have a structure like this:
MyProject/
+ src/
+ bin/
And the JunitDoclet plugin will create another source folder, so you will end up with:
MyProject/
+ src/
+ bin/
+ test/
Please tell me if this solves your problem, so that I put that in the doco (and/or I add the possibility to use the root of the project as the source folder) for the next release.
HTH,
Regards,
Fabrice.
Hi Fabrice,
you were right, that really solved the problem! Thank you very much.
Another question, just because I'm interested: while the plugin didn't work (for me), I tried to run it with Eclipse and ant, but as I'm new to ant, I had difficulties to set up a correct build.xml. So I googled for some more detailed examples than the one coming with the JunitDoclet distribution, but didn't find anything useful. Do you know where I could find such an example build file?
Regards,
Julien aka Shiggy
Well, I remember I wrote my own Ant script... Maybe you could email the JUnitDoclet guys so that they can provide you with such a build file. And even ask them to put such a file in the distrib!