aspose file tools*
The moose likes Testing and the fly likes Problem with ANT and Selenium-RC(JUnits) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Problem with ANT and Selenium-RC(JUnits)" Watch "Problem with ANT and Selenium-RC(JUnits)" New topic
Author

Problem with ANT and Selenium-RC(JUnits)

Evan Moreshead
Greenhorn

Joined: Jul 30, 2009
Posts: 2
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

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Jul 30, 2009
Posts: 2
Sorry bout that, here's a good chunk of my what I'm working with.



David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Aug 09, 2009
Posts: 74
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with ANT and Selenium-RC(JUnits)
 
Similar Threads
error while running a program
Issues with cmd java command
UnsupportedClassVersionError (unsupported major.minor version 50.0)
while running junit it is throwing java.lang.Unsupported Class Version Error
Ant unable to find javac compiler (in Eclipse)