• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ant and JUnit

 
Karthik Veeramani
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i wanted to run some testcases, and send the report to a folder named 'report'. when i try to run the script, ant doesnt recognise the junit tag, it throws an error
"Could not create task or type of type:junit"
"Ant could not find the task or a class this task relies upon."
Can any1 pls give me a small piece of code that runs a batchtest, including all the files in a directory, sending the report to some directory.
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have junit.jar in your ${ANT_HOME}/lib?
 
Karthik Veeramani
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks, i thought ant packs it with optional.jar. but theres another doubt now (might be a dumber 1) -
the testcases run, and the report keeps giving ClassNotFoundException for all my testcase classes. this is how my directory structure is -
lets say my project has only 1 package, xyz.
i hav a folder src, inside that a folder xyz, inside which the code resides. inside this src folder, theres another folder testcases, inside which the testcase code resides (the testcase classes r written with same package structure, ie., each test class will b in a package testcases.xyz.ClassName) ... similarly, theres a 'bin' folder, and the same directory structure inside. these folders hold the compiled classes.
Should the ant script using junit tag point to the source directory, or to the compiled class files?
my junit task code contains something like
fileset dir="${src}" includes="**/*Test*.java"
will this take care of all the subfolders inside src?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic