• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Why doesn't the JUnit test OUTPUT appear using the Ant build?

 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why doesn't the JUnit test OUTPUT appear using the Ant build

<target name="JUnit test">
<junit printsummary="true" showoutput="yes">
<classpath refid="test.classpath"/>
<formatter type="plain"/>
</junit>
</target>

Thanks.
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Think you might be missing this...

From my build file
 
Abder-Rahman Ali
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Seamus Minogue wrote:

Think you might be missing this...

From my build file



Thank you very much.
 
Abder-Rahman Ali
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why do I get this error when I run the Ant build file?

Testsuite: JUnit
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec

Caused an ERROR
JUnit
java.lang.ClassNotFoundException: JUnit
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
 
Seamus Minogue
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
looks like you need to tweak that classpath entry I gave you so that junit.jar is on it.

^^ Idiocy please ignore


Actually im sorry I am seeing things. Your test case is called JUnit!

Ok well THAT isnt on the classpath...
 
Abder-Rahman Ali
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Seamus Minogue wrote:looks like you need to tweak that classpath entry I gave you so that junit.jar is on it.



Since I'm using "Eclipse", I added JUnit to Ant, so it is working properly.

But, as for the test that you gave me, what should I change in it?

Thanks.
 
Seamus Minogue
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Create a property called build.tests which has a value that is the same as where your javac command compiled your test classes to and it should work
 
Abder-Rahman Ali
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Seamus Minogue wrote:Create a property called build.tests which has a value that is the same as where your javac command compiled your test classes to and it should work



This is what I get when I run it:

Testsuite‭: ‬PojoTests
Tests run‭: ‬1‭, ‬Failures‭: ‬0‭, ‬Errors‭: ‬1‭, ‬Time elapsed‭: ‬0‭ ‬sec

Caused an ERROR
PojoTests
java.lang.ClassNotFoundException‭: ‬PojoTests
at java.net.URLClassLoader$1‭.‬run(URLClassLoader.java:200‭)‬
at java.security.AccessController.doPrivileged(Native Method‭)‬
at java.net.URLClassLoader.findClass(URLClassLoader.java:188‭)‬
at java.lang.ClassLoader.loadClass(ClassLoader.java:316‭)‬
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280‭)‬
at java.lang.ClassLoader.loadClass(ClassLoader.java:251‭)‬
at java.lang.ClassLoader.loadClass(ClassLoader.java:251‭)‬
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374‭)‬
at java.lang.Class.forName0‭(‬Native Method‭)‬
at java.lang.Class.forName(Class.java:242‭)‬
at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32‭)‬
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423‭)‬
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137‭)‬


Provided that I thin you should have a "/" at the end of the following line:

<pathelement path="${classpath}" >
 
Seamus Minogue
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oops... copy paste error.

I think you're right

Sorry about that
 
Abder-Rahman Ali
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Seamus Minogue wrote:oops... copy paste error.

I think you're right

Sorry about that



Thats fine. but, still is not working, don't know why.
 
author & internet detective
Posts: 41086
848
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Abder-Rahman Ali wrote:Thats fine. but, still is not working, don't know why.


What does 'not working" mean? Do you get an error message?
 
look! it's a bird! it's a plane! It's .... a teeny tiny ad
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic