Note that there are some explanatory texts on larger screens.

plurals
  1. POAnt Build file with junit test for java project
    primarykey
    data
    text
    <p>I am trying to write an android build file that compiles, creates a jar executes it and also runs a bunch of test files. This is what I have so far, but not sure how to proceed with writing the test block. I have looked around but an example of a build file with junit testing but haven't found any..an example of a ant file with junit would be helpful please</p> <p></p> <pre><code>&lt;property name="src.dir" value="src"/&gt; &lt;property name="build.dir" value="build"/&gt; &lt;property name="classes.dir" value="${build.dir}/classes"/&gt; &lt;property name="jar.dir" value="${build.dir}/jar"/&gt; &lt;property name="test.dir" value="${build.dir}/test"/&gt; &lt;property name="main-class" value="com.arkangelx.classes.ATMLauncher"/&gt; &lt;property name="TALK" value="true" /&gt; &lt;target name="clean"&gt; &lt;delete dir="${build.dir}"/&gt; &lt;/target&gt; &lt;target name="compile"&gt; &lt;mkdir dir="${classes.dir}"/&gt; &lt;javac srcdir="${src.dir}" destdir="${classes.dir}" verbose="${TALK}"/&gt; &lt;/target&gt; &lt;target name="jar" depends="compile"&gt; &lt;mkdir dir="${jar.dir}"/&gt; &lt;jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}"&gt; &lt;manifest&gt; &lt;attribute name="Main-Class" value="${main-class}"/&gt; &lt;/manifest&gt; &lt;/jar&gt; &lt;/target&gt; &lt;target name="test" depends="run"&gt; &lt;mkdir dir="${test.dir}"/&gt; &lt;test destfile="${test.dir}/${ant.project.name}.test" basedir="${build.dir}"&gt; &lt;junit&gt; &lt;classpath refid="classpath.test" /&gt; &lt;formatter type="brief" usefile="false" /&gt; &lt;test name="TestExample" /&gt; &lt;/junit&gt; &lt;/test&gt; &lt;/target&gt; &lt;target name="run" depends="jar"&gt; &lt;java jar="${jar.dir}/${ant.project.name}.jar" fork="true"/&gt; &lt;/target&gt; &lt;target name="clean-build" depends="clean,jar"/&gt; &lt;target name="main" depends="clean,run"/&gt; </code></pre> <p></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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