ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 51788] JUnitResultFormatter#endTestSuite called too late
Date Wed, 07 Dec 2011 09:27:20 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=51788

--- Comment #2 from Paul Schwann <paul.schwann@gmail.com> 2011-12-07 09:27:20 UTC ---
Hi there,

I only described what I see. 

We have made our own implementation of a JUnitResultFormatter (required to
create some extremely simplified CSV file containing the results for further
post-processing). We incorporated that formatter in the ANT file executing the
unit tests. It is called indeed but we've noticed that every output created in
the #endTestSuite method doesn't show up.

A reduced version of our implementation looks like this:

public class CsvJUnitResultFormatter implements JUnitResultFormatter {
  private OutputStream os;

  @Override public void setOutput(OutputStream out) { this.os = out; }

  ...

  @Override public void endTest(Test test) {
    os.write(...); // works like a charm (since os is open and ready)
  }

  @Override public void endTestSuite(JUnitTest suite) throws BuildException {
    os.write(...); // doesn't produce any output since os is closed already
  }

  ...
}

The attempt to write something to the output stream in #endTestSuite() provided
by the TestRunner doesn't produce the desired result. It works in all other
methods of the interface (e.g. startTest, endTest etc.), though.

Our investigation showed that the output stream provided by the test runner
environment via #setOutput(...) is closed already once #endTestSuite is called.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Mime
View raw message