Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Problem with ANT and Selenium-RC(JUnits)

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry bout that, here's a good chunk of my what I'm working with.



 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic