Note that there are some explanatory texts on larger screens.

plurals
  1. POAnother simple problem with integrating Junit and Ant
    text
    copied!<p>I can't get my Junit tests to run from my <code>build.xml</code> script. I feel like I have tried everything. </p> <p>Here is my <code>build.xml</code> script.</p> <pre><code> &lt;property file="build.properties"/&gt; &lt;property name="src.dir" value="src"/&gt; &lt;property name="build.dir" value="classes"/&gt; &lt;property name="web.dir" value="war"/&gt; &lt;property name="test.dir" value="test"/&gt; &lt;path id="build.classpath"&gt; &lt;fileset dir="lib"&gt; &lt;include name="*.jar"/&gt; &lt;/fileset&gt; &lt;!-- servlet API classes: --&gt; &lt;fileset dir="${appserver.lib}"&gt; &lt;include name="servlet*.jar"/&gt; &lt;/fileset&gt; &lt;pathelement path="${build.dir}"/&gt; &lt;pathelement path="${test.dir}"/&gt; &lt;/path&gt; &lt;path id="classpath.base"/&gt; &lt;path id="classpath.test"&gt; &lt;pathelement location="c:/ant/lib/junit.jar" /&gt; &lt;pathelement location="${build.dir}"/&gt; &lt;pathelement location="${src.dir}"/&gt; &lt;pathelement location="${test.dir}" /&gt; &lt;path refid="classpath.base" /&gt; &lt;/path&gt; &lt;target name="build"&gt; &lt;mkdir dir="${build.dir}"/&gt; &lt;javac destdir="${build.dir}" source="1.5" target="1.5" debug="true" deprecation="false" optimize="false" failonerror="true"&gt; &lt;src path="${src.dir}"/&gt; &lt;classpath refid="build.classpath" source="1.5" target="1.5" debug="true" deprecation="false" optimize="false" failonerror="true"/&gt; &lt;/javac&gt; &lt;/target&gt; &lt;target name="test"&gt; &lt;junit haltonfailure="true"&gt; &lt;classpath refid="classpath.test" /&gt; &lt;classpath refid="build.classpath"/&gt; &lt;formatter type="brief" usefile="false" /&gt; &lt;test name="com.mmz.mvc.test.PracticeTest" /&gt; &lt;/junit&gt; &lt;/target&gt; </code></pre> <p>I am getting the following error message from the console.</p> <pre> test: [junit] Testsuite: com.mmz.mvc.test.PracticeTest [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec [junit] Null Test: Caused an ERROR [junit] com.mmz.mvc.test.PracticeTest [junit] java.lang.ClassNotFoundException: com.mmz.mvc.test.PracticeTest [junit] at java.lang.ClassLoader.loadClass(ClassLoader.java:248) [junit] at java.lang.Class.forName0(Native Method) [junit] at java.lang.Class.forName(Class.java:247) [junit] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) [junit] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) [junit] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137) BUILD FAILED C:\Users\Eric\Documents\Java\mmz\WEB-INF\build.xml:44: Test com.mmz.mvc.test.PracticeTest failed </pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload