Reputation: 1
I am using travis CI for first time for JUnit testcase automation. My code works fine in local but Travis CI gives me below issue.
"The classpath for junit must include junit.jar if not in Ant's own classpath."
Code: https://github.com/aswintowin/fizzbuzz-selenium
Can someone help me with this.
Upvotes: 0
Views: 831
Reputation: 1060
Your build script references JUnit and Hamcrest Jars relative to your project at ../../Downloads/
. Travis wont have a similar downloads folder, and Ant doesn't complain about not finding classpath entries you tell it to look for, so it's not finding these Jars when running on Travis but not warning you as to why.
You therefore need to include the JUnit Jars and any dependencies in a directory in your project (e.g. create a lib
directory in your project root containing the Jars you currently reference in your downloads folder), and update your build.xml to reference these Jars instead of the ones in your downloads folder.
It's also worth noting that your build.xml shouldn't have to explicitly declare ant-junit-1.8.4.jar as being on the classpath for you task, as this is normally in the Ant lib
directory and is therefore automatically available to all the Ant tasks that need it. Not depending on a certain version of this Jar also means your can move between versions of Ant without worry.
Upvotes: 1