commit 3ce24cc1dd6bc9eeaffa3d38a820a3199e0de0c5 Author: Tejal Desai Date: Mon Jun 22 12:49:56 2015 -0700 [junit tool] fix suppress output emits jibberish on console. At twitter, since org.pantsbuild.junit-runner-0.0.5 upgrade, we saw issues reported with test.junit --no-supress-output flag. Easily reproducable as mentioned in https://github.com/pantsbuild/pants/issues/1657 This rb is fixing 2 issues: 1. test.junit --no-supress-output emits jibberish on console. In https://rbcommons.com/s/twitter/r/2183 @fkorotkov added a MultiOutputStream. However with tests running in paralled the writes were not synchornized. Deleting this Class and using TeeOutputStream http://grepcode.com/file/repo1.maven.org/maven2/commons-io/commons-io/2.0.1/org/apache/commons/io/output/TeeOutputStream.java 2. test output and errors files only log output from first testmethod. This rb https://rbcommons.com/s/twitter/r/2257/diff/1#index_header caused a regression. While debugging a TestCase where there are 2 test methods, i found out that only output from one test would get written in the .out.txt. This is because, registerTests() would return the count of Tests as 1. testStarted gets invoked with testmethod (hence the number of tests is 1) instead of testclass. This will set the useCount=1 and when testFinished is fired for the first test, it would close the file stream. https://github.com/pantsbuild/pants/blob/master/src/java/org/pantsbuild/tools/junit/ConsoleRunner.java#L134 and https://github.com/pantsbuild/pants/blob/master/src/java/org/pantsbuild/tools/junit/ConsoleRunner.java#L217 The power PowerMockRunNotifier.java in 1.16.2 does use https://github.com/jayway/powermock/blame/9bd63da355f0ab862880e72976770ae44851f6c7/modules/module-impl/junit4/src/main/java/org/powermock/modules/junit4/internal/impl/PowerMockRunNotifier.java#L96 I am more inclined on reverting this and upgrading to powermock-1.6 if we see any Null pointer exceptions. Testing Done: With locally published jar, 03:45:53 00:01 [junit] 03:45:53 00:01 [run] ........ Time: 0.002 OK (7 tests) .test41 .start test42 end test42 .... Time: 15.075 OK (6 tests) ..... Time: 0 OK (4 tests) ... Time: 0 OK (2 tests) ... Time: 0 OK (2 tests) ......E Time: 0.007 Tests run: 5, Failures: 1 ... Time: 0.006 OK (2 tests) .... Time: 0.006 OK (3 tests) ......test41 .start test42 end test42 ....... Time: 45.392 OK (22 tests) Waiting for background workers to finish. 03:46:39 00:47 [complete] SUCCESS Bugs closed: 1657 Reviewed at https://rbcommons.com/s/twitter/r/2395/ .../tools/junit/impl/AntJunitXmlReportListener.java | 7 +++++-- .../tools/junit/impl/ConsoleRunnerImpl.java | 20 ++++++++++++++++---- 2 files changed, 21 insertions(+), 6 deletions(-) commit e11cabc8178719ff364d9b7803f128ecdf58dbf8 Author: Eric Ayers Date: Fri Jun 19 21:25:58 2015 -0400 In junit-runner, fix an NPE in testFailure() for different scenarios In AntJunitXmlReportListener, there are cases where `testFailed()` is invoked without a class or invoked without `testStarted()` being called. Some of these scenarios are outlined in http://junit.org/javadoc/latest/org/junit/runner/notification/RunListener.html Testing Done: CI is running at https://travis-ci.org/pantsbuild/pants/builds/67211843 Added a unit test. Also ran this in our repo. It got rid of the exceptions reported in issue #1234 popping onto the console of the form: ``` 1) Test mechanism java.lang.NullPointerException at com.twitter.common.junit.runner.ConsoleRunner$StreamCapturingListener.testStarted(ConsoleRunner.java:205) at com.twitter.common.junit.runner.ForwardingListener$3.fire(ForwardingListener.java:60) at com.twitter.common.junit.runner.ForwardingListener.fire(ForwardingListener.java:34) at com.twitter.common.junit.runner.ForwardingListener.testStarted(ForwardingListener.java:58) at com.twitter.common.junit.runner.AbortableListener.testStarted(AbortableListener.java:29) ``` Bugs closed: 1234, 1703 Reviewed at https://rbcommons.com/s/twitter/r/2385/ .../junit/impl/AntJunitXmlReportListener.java | 108 ++++++++++++++++++--- 1 file changed, 92 insertions(+), 16 deletions(-)