Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>When you setup JUnit, set both <code>haltonerror</code> and <code>haltonfailure</code> to <code>false</code>. This way, JUnit will continue processing. Then, also setup <code>errorproperty</code> and <code>failureproperty</code> parameters too. Run JUnit as you normally would. If you want to produce the report, produce the report. Then use the <code>&lt;fail/&gt;</code> task to fail the build if either the error property or failure property report an error:</p> <pre><code>&lt;target name = "test" depends="compiletest" description="run unit tests"&gt; &lt;junit haltonfailure="false" haltonerror="false" failureproperty="failure.in.testing" errorproperty="error.in.testing"&gt; &lt;classpath path="${buildtest}"&gt; &lt;path refid="test.classpath"/&gt; &lt;/classpath&gt; &lt;batchtest fork="yes"&gt; &lt;formatter type="brief" usefile="false"/&gt; &lt;fileset dir="${test}"&gt; &lt;include name="**/*Test.java"/&gt; &lt;include name="**/Test*.java"/&gt; &lt;/fileset&gt; &lt;/batchtest&gt; &lt;/junit&gt; &lt;!-- Now that everything has run, we'll check the error.in.testing --&gt; &lt;!-- and the failure.in.testing properties to see if there were errors --&gt; &lt;!-- of failed tests. --&gt; &lt;fail message="JUnit had at least one error in a test${line.break}${error.in.testing}"&gt; &lt;condition&gt; &lt;length string="${error.in.testing}" when="greater" length="0"/&gt; &lt;/condition&gt; &lt;/fail&gt; &lt;fail message="JUnit had at least one failed test${line.break}${failure.in.testing}"&gt; &lt;condition&gt; &lt;length string="${failure.in.testing}" when="greater" length="0"/&gt; &lt;/condition&gt; &lt;/fail&gt; &lt;/target&gt; </code></pre> <p>I MAY have been able to use the <code>isset</code> condition:</p> <pre><code> &lt;fail message="JUnit had at least one error in a test${line.break}${error.in.testing}"&gt; &lt;condition&gt; &lt;isset property"error.in.testing"/&gt; &lt;/condition&gt; &lt;/fail&gt; &lt;fail message="JUnit had at least one failed test${line.break}${failure.in.testing}"&gt; &lt;condition&gt; &lt;isset property"failure.in.testing"/&gt; &lt;/condition&gt; &lt;/fail&gt; </code></pre> <p>However, I wasn't sure whether these properties are unset or merely equal to a null string.</p>
    singulars
    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.
    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