Browse Source

Junit task -- display suite first

PR: 31962
Obtained from: Kevin Jackson


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277033 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 20 years ago
parent
commit
866b754aad
3 changed files with 38 additions and 13 deletions
  1. +4
    -1
      WHATSNEW
  2. +14
    -6
      src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java
  3. +20
    -6
      src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java

+ 4
- 1
WHATSNEW View File

@@ -81,7 +81,10 @@ Other changes:
* New task <getlibraries> can retrieve library files from a maven repository.

* unzip/unwar/unjar/untar now supports a nested mapper, which lets you unzip
in useful ways.
in useful ways.

* Junit task -- display suite first.
Bugzilla report 31962.

Changes from Ant 1.6.2 to current Ant 1.6 CVS version
=====================================================


+ 14
- 6
src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java View File

@@ -94,19 +94,27 @@ public class BriefJUnitResultFormatter implements JUnitResultFormatter {

/**
* The whole testsuite started.
* @param suite the test suite
*/
public void startTestSuite(JUnitTest suite) throws BuildException {
public void startTestSuite(JUnitTest suite) {
if (output == null) {
return; // Quick return - no output do nothing.
}
String newLine = System.getProperty("line.separator");
StringBuffer sb = new StringBuffer("Testsuite: ");
sb.append(suite.getName());
sb.append(newLine);
output.write(sb.toString());
output.flush();
}

/**
* The whole testsuite ended.
* @param suite the test suite
*/
public void endTestSuite(JUnitTest suite) throws BuildException {
public void endTestSuite(JUnitTest suite) {
String newLine = System.getProperty("line.separator");
StringBuffer sb = new StringBuffer("Testsuite: ");
sb.append(suite.getName());
sb.append(newLine);
sb.append("Tests run: ");
StringBuffer sb = new StringBuffer("Tests run: ");
sb.append(suite.runCount());
sb.append(", Failures: ");
sb.append(suite.failureCount());


+ 20
- 6
src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java View File

@@ -81,20 +81,34 @@ public class PlainJUnitResultFormatter implements JUnitResultFormatter {
}

/**
* Empty.
* The whole testsuite started.
* @param suite the test suite
* @throws BuildException if unable to write the output
*/
public void startTestSuite(JUnitTest suite) {
public void startTestSuite(JUnitTest suite) throws BuildException {
if (out == null) {
return; // Quick return - no output do nothing.
}
String newLine = System.getProperty("line.separator");
StringBuffer sb = new StringBuffer("Testsuite: ");
sb.append(suite.getName());
sb.append(newLine);
try {
out.write(sb.toString().getBytes());
out.flush();
} catch (IOException ex) {
throw new BuildException("Unable to write output", ex);
}
}

/**
* The whole testsuite ended.
* @param suite the test suite
* @throws BuildException if unable to write the output
*/
public void endTestSuite(JUnitTest suite) throws BuildException {
String newLine = System.getProperty("line.separator");
StringBuffer sb = new StringBuffer("Testsuite: ");
sb.append(suite.getName());
sb.append(newLine);
sb.append("Tests run: ");
StringBuffer sb = new StringBuffer("Tests run: ");
sb.append(suite.runCount());
sb.append(", Failures: ");
sb.append(suite.failureCount());


Loading…
Cancel
Save