You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Jonas Arnsmann <jo...@globolog.com> on 2008/03/06 17:50:38 UTC
JUnit Testing in James 2.3.1
Hi there,
I am developing a couple of custom Mailets for James 2.3.1 and i'm currently
trying to figure out how to realize automatic JUnit Tests for my Mailets..
Looking through the code in the Apache SVN (http://svn.apache.org/repos/asf/james/server/
tags/build_2_3_1/src/test/org/apache/james/) shows me, that you already have some JUnit
test code available.
However this code fails to run on my machine (have tried it on Windows/Linux and even OS X)
Junit 4.4 was not included in the lib folder of the original distribution
(include in build.xml was missing), so i thought this might be the issue...
I fixed this by editing build.xml:
<include name="${junit.jar}"/>
as well as include.properties:
# ----- JUnit tests -----
junit.jar=junit-4.4.jar
But the ANT script still keeps failing, when i execute the target run-unit-tests
(log is snipped, this happens for ALL tests executed)
[junit] java.io.FileNotFoundException: /home/jonas/workspace/James/junitvmwatcher1170505572.properties (No such file or
directory)
[junit] at java.io.FileInputStream.open(Native Method)
[junit] at java.io.FileInputStream.<init>(FileInputStream.java:106)
[junit] at java.io.FileReader.<init>(FileReader.java:55)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeAsForked(JUnitTask.java:1028)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:817)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeOrQueue(JUnitTask.java:1657)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:764)
[junit] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[junit] at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
[junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[junit] at java.lang.reflect.Method.invoke(Method.java:585)
[junit] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
[junit] at org.apache.tools.ant.Task.perform(Task.java:348)
[junit] at org.apache.tools.ant.Target.execute(Target.java:357)
[junit] at org.apache.tools.ant.Target.performTasks(Target.java:385)
[junit] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
[junit] at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
[junit] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[junit] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
[junit] at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
[junit] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
[junit] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
[junit] Running org.apache.james.util.ExtraDotOutputStreamTest
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
[junit] Test org.apache.james.util.ExtraDotOutputStreamTest FAILED (crashed)
Any ideas what might be wrong here?! I must admit i'm not an expert on junit ;)
Greetings from Germany,
Jonas Arnsmann
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: JUnit Testing in James 2.3.1
Posted by Bernd Fondermann <bf...@brainlounge.de>.
Hi Jonas,
this seems to be a problem related to ant and junit and not to be
James-specific.
please google for "junitvmwatcher"
for example you might come across this bugreport
https://issues.apache.org/bugzilla/show_bug.cgi?id=41511
a quick review of the bug evaluations seems to indicate some problematic
mixture of ant version on the classpath, but please take a look for
yourself.
Bernd
Jonas Arnsmann wrote:
> Hi there,
>
> I am developing a couple of custom Mailets for James 2.3.1 and i'm
> currently
> trying to figure out how to realize automatic JUnit Tests for my Mailets..
>
> Looking through the code in the Apache SVN
> (http://svn.apache.org/repos/asf/james/server/
> tags/build_2_3_1/src/test/org/apache/james/) shows me, that you already
> have some JUnit
> test code available.
>
> However this code fails to run on my machine (have tried it on
> Windows/Linux and even OS X)
> Junit 4.4 was not included in the lib folder of the original distribution
> (include in build.xml was missing), so i thought this might be the issue...
>
> I fixed this by editing build.xml:
> <include name="${junit.jar}"/>
>
> as well as include.properties:
> # ----- JUnit tests -----
> junit.jar=junit-4.4.jar
>
> But the ANT script still keeps failing, when i execute the target
> run-unit-tests
> (log is snipped, this happens for ALL tests executed)
>
> [junit] java.io.FileNotFoundException:
> /home/jonas/workspace/James/junitvmwatcher1170505572.properties (No such
> file or directory)
> [junit] at java.io.FileInputStream.open(Native Method)
> [junit] at java.io.FileInputStream.<init>(FileInputStream.java:106)
> [junit] at java.io.FileReader.<init>(FileReader.java:55)
> [junit] at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeAsForked(JUnitTask.java:1028)
>
> [junit] at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:817)
>
> [junit] at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeOrQueue(JUnitTask.java:1657)
>
> [junit] at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:764)
>
> [junit] at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
> [junit] at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
> [junit] at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
> [junit] at java.lang.reflect.Method.invoke(Method.java:585)
> [junit] at
> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
> [junit] at org.apache.tools.ant.Task.perform(Task.java:348)
> [junit] at org.apache.tools.ant.Target.execute(Target.java:357)
> [junit] at org.apache.tools.ant.Target.performTasks(Target.java:385)
> [junit] at
> org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
> [junit] at
> org.apache.tools.ant.Project.executeTarget(Project.java:1298)
> [junit] at
> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
>
> [junit] at
> org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
>
> [junit] at
> org.apache.tools.ant.Project.executeTargets(Project.java:1181)
> [junit] at
> org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
>
> [junit] at
> org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
>
> [junit] Running org.apache.james.util.ExtraDotOutputStreamTest
> [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
> [junit] Test org.apache.james.util.ExtraDotOutputStreamTest FAILED
> (crashed)
>
> Any ideas what might be wrong here?! I must admit i'm not an expert on
> junit ;)
>
> Greetings from Germany,
> Jonas Arnsmann
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: JUnit Testing in James 2.3.1
Posted by Stefano Bagnara <ap...@bago.org>.
Use junit 3.8.x and put the jars in your ant lib folder. It should work.
Unfortunately ant was a bit tricky wrt junit.jar and classpath and there
was no "perfect" solution.
Stefano
Jonas Arnsmann ha scritto:
> Hi there,
>
> I am developing a couple of custom Mailets for James 2.3.1 and i'm
> currently
> trying to figure out how to realize automatic JUnit Tests for my Mailets..
>
> Looking through the code in the Apache SVN
> (http://svn.apache.org/repos/asf/james/server/
> tags/build_2_3_1/src/test/org/apache/james/) shows me, that you already
> have some JUnit
> test code available.
>
> However this code fails to run on my machine (have tried it on
> Windows/Linux and even OS X)
> Junit 4.4 was not included in the lib folder of the original distribution
> (include in build.xml was missing), so i thought this might be the issue...
>
> I fixed this by editing build.xml:
> <include name="${junit.jar}"/>
>
> as well as include.properties:
> # ----- JUnit tests -----
> junit.jar=junit-4.4.jar
>
> But the ANT script still keeps failing, when i execute the target
> run-unit-tests
> (log is snipped, this happens for ALL tests executed)
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org