title: How do I configure JUnit Ant task to only produce output on failures?
body: <p>I am configuring JUnit in Ant so that unit tests will be run on each build. I would like the output of <em>failing</em> tests to be printed in the Ant console output whenever they are run. I don't need to see any output from succeeding tests.</p>
  
  <p>Here is the relevant bit of my <code>build.xml</code> file:</p>
  
  <pre><code>&lt;junit&gt;
      &lt;classpath&gt;
          &lt;pathelement path="${build}"/&gt;
      &lt;/classpath&gt;
      &lt;formatter type="brief" usefile="false"/&gt;
      &lt;batchtest&gt;
          &lt;fileset dir="${src}" includes="my/tree/junit/"/&gt;
      &lt;/batchtest&gt;
  &lt;/junit&gt;
  </code></pre>
  
  <p>This produces almost what I want, failing tests are detailed in the Ant output, except that succeeding tests also write the following output:</p>
  
  <pre>    [junit] Testsuite: my.tree.junit.ExampleTest
      [junit] Tests run: 7, Failures: 0, Errors: 0, Time elapsed: 0.002 sec</pre>
  
  <p>I believe I have tried all the combinations listed in the <a href="http://ant.apache.org/manual/Tasks/junit.html" rel="noreferrer">JUnit task</a> documentation, including:</p>
  
  <ul>
  <li><code>printsummary</code> attribute</li>
  <li><code>showoutput</code> attribute</li>
  <li><code>formatter</code> element with each kind of <code>type</code></li>
  </ul>
  
  <p>My use case is running <code>ant</code> from the command line. As I write more tests, I don't want the output from succeeding tests to be so large that output from failing tests scrolls off the screen. I just want <code>ant</code> to be quiet unless there's a failing test that needs my attention. How can I configure Ant/JUnit to do this?</p>
  
  <p>I am using Ant version 1.6.4 and JUnit 4.6.</p>