ClassNotFoundException on a JUNIT ant script -
i have written few test scripts using junit 4 , selenium. have added jar files junit , selenium eclipse , if run tests through eclipse ide working expected.
i trying run these tests through ant script below:
<project name="junit" default="test"> <property name="src" value="./src" /> <property name="classes" value="./classes" /> <property name="test.class.name" value="alltests" /> <path id="test.classpath"> <pathelement location="${classes}" /> <pathelement location="c:/program files/eclipse 3.5/plugins/org.junit4_4.5.0.v20090824/junit.jar" /> <pathelement location="c:/selenium/selenium-server-standalone-2.0b2.jar" /> <pathelement location="c:/program files/eclipse 3.5/plugins/org.hamcrest.core_1.1.0.v20090501071000.jar" /> </path> <target name="test"> <junit fork="yes" haltonfailure="yes"> <test name="${test.class.name}" /> <formatter type="plain" usefile="false" /> <classpath refid="test.classpath" /> </junit> </target> </project>
the problem when run ant script getting following exception:
[junit] java.lang.classnotfoundexception: alltests [junit] @ java.net.urlclassloader$1.run(unknown source) [junit] @ java.security.accesscontroller.doprivileged(native method) [junit] @ java.net.urlclassloader.findclass(unknown source) [junit] @ java.lang.classloader.loadclass(unknown source) [junit] @ sun.misc.launcher$appclassloader.loadclass(unknown source) [junit] @ java.lang.classloader.loadclass(unknown source) [junit] @ java.lang.class.forname0(native method) [junit] @ java.lang.class.forname(unknown source)
i have added jar files see in eclipse .classpath file bit confused of files missing.
found problem, stupid 1 guess lack of concentration... .class files in ./bin folder , ant script pointing ./classes. copied old ant script i've been using , didn't take notice of properties configured.
Comments
Post a Comment