Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with ANT and Selenium-RC(JUnits)

 
Evan Moreshead
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm having trouble trying to run a selenium test suite as through ANT. The suite runs as main method and that's I'm trying to run. But when I run the suite I get a beautiful exception which I can't seem to resolve. I've been getting:

[java] java.lang.NoClassDefFoundError: junit/framework/Test
[java] Caused by: java.lang.ClassNotFoundException: junit.framework.Test
[java] at java.net.URLClassLoader$1.run(Unknown Source)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.net.URLClassLoader.findClass(Unknown Source)
[java] at java.lang.ClassLoader.loadClass(Unknown Source)
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
[java] at java.lang.ClassLoader.loadClass(Unknown Source)
[java] at java.lang.ClassLoader.loadClassInternal(Unknown Source)
[java] Could not find the main class: com.ew.vendor.tests.Suite. Program will exit.
[java] Exception in thread "main"
[java] Java Result: 1

I do have my JUnit in my classpath, I've run test that they recomend running to make sure everything has been installed correctly
I have tried running the jar file I make through the command line and it fails, but I can run it through eclipse.

any help would be very much appreciated.
Thanks
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's almost certainly a classpath issue; without knowing how you're configuring Ant and/or your project it'll be tough to help.
 
Evan Moreshead
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry bout that, here's a good chunk of my what I'm working with.



 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is "run" the task that's supposed to run the tests? I'd consider actually building a real Ant classpath rather than relying on the manifest (if that would even work to begin with).
 
Guy Roth
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is how I run Selenium-RC Wrapped in JUnit process thorugh Ant:
<target name="acm.execute-selenium">
<junit printsummary="yes" errorproperty="juerr" failureproperty="jufailure" timeout="12000000" fork="true">
<classpath>
<pathelement location="${wsjunit.lib}"/>
<fileset dir="${wsjunit.lib}">
<include name="**/*.jar"/>
</fileset>
</classpath>
<formatter type="xml" />
<batchtest todir="log">
<fileset dir="${out.wsjunit}">
<include name="**/selenium/**/*Test.class" />
</fileset>
</batchtest>
</junit>
</target>

where wsjunit.lib should contain the path to the lib folder where JUnit jars as well as Selenium jars located.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic