• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Juint task in Ant

 
Hongli Li
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • 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 ]
 
Jan Cumps
Bartender
Posts: 2602
13
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • 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
  • 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: 2602
13
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic