Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Juint task in Ant

 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, folks,

I spent the whole afternoon trying to figure out why I couldn't run junit with ant, but unfortunately, it didn't work for me.Can somebody help me?

part of my build.xml:



I'm sure the sequence of compiling test and source code is correct, I added the lib, src/classes, and test/classes to test.classpath which is defined in
path datatype. I test my code in Junit from Eclipse, it passed! When I tried to run it with ANT, then I always got this error:

here is the console output:

I also tried to run ant in eclipse, it didn't work in eclipse neither.
When I run "which ant" in my console, it displays /usr/bin/ant.
Anyone has any clue? Any suggestion is high appreciated.
[ January 10, 2008: Message edited by: Hongli Li ]
 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you follow Ant's instructions You must have junit.jar available?

Try running ant with the -verbose option to get more details logged.

Regards, Jan
 
Hongli Li
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for you reply, Jan

yes, I did follow ant's instruction. junit-3.8.2.jar is under $ANT_HOME/lib folder, as you can see from the log, junit-3.8.2.jar is implicitly added to the classpath.

the following is what I got with -verbose mode.

 
Jan Cumps
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

java.lang.ClassNotFoundException: first ant junit test

'first ant junit test' is not a valid java class name. Your test class has to be a valid java class, say FirstAntJunitTest.

Regards, Jan
 
Hongli Li
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks a lot Jan,
I overlooked at that line, My bad, I thought the test node inside Junit is just served as meta info, but actually it should be a full qualified class name.

cheers
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic