This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 208654 - Do not require showoutput=true on <junit>
Summary: Do not require showoutput=true on <junit>
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: JUnit (show other bugs)
Version: 7.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: Theofanis Oikonomou
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-20 15:56 UTC by Jesse Glick
Modified: 2016-07-07 07:15 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2012-02-20 15:56:53 UTC
All the NetBeans-managed build scripts which use <junit> (nbproject/build-impl.xml, also nbbuild/templates/common.xml and so on) seem to use both showoutput="true" and <formatter type="brief" usefile="false"/>. This is problematic because it means that test stdout & stderr appears *twice* in the Output Window, often intermixed unreadably. If the formatter is omitted, then stack traces are not shown, which is unacceptable. If showoutput="false" (the default), the Output Window results look OK, but the Test Results window now does not show any output.

Why does the JUnit Ant logger rely on showoutput="true", i.e. capture stdio from log messages? It could get stdio from TEST-*.xml#/testsuite/(system-out or system-err) after the test completes, and/or find the logged messages starting with "------------- Standard Output ---------------" or "------------- Standard Error -----------------" and ending with "------------- ---------------- ---------------". With that improvement, showoutput="true" could be removed from various scripts, making for much better readability of test results in the Output Window, especially for tests printing long logs.

Note that both of the above fail to show stdout and stderr intermixed in order of printing, though since stdout is buffered and stderr is unbuffered it is generally unwise to intermix them anyway (you often end up with a mangled mess).

Remember that since the logger needs to work with <junit> task invocations not created by NB developers (for example in freeform projects), it ought to be conservative and get whatever information it can. It can of course inspect the parameters actually passed to <junit> when the task starts, to decide how it should collect information such as stdio.
Comment 1 Theofanis Oikonomou 2013-12-19 15:20:25 UTC
(In reply to Jesse Glick from comment #0)
> All the NetBeans-managed build scripts which use <junit>
> (nbproject/build-impl.xml, also nbbuild/templates/common.xml and so on) seem
> to use both showoutput="true" and <formatter type="brief" usefile="false"/>.
> This is problematic because it means that test stdout & stderr appears
> *twice* in the Output Window, often intermixed unreadably. If the formatter
> is omitted, then stack traces are not shown, which is unacceptable. If
> showoutput="false" (the default), the Output Window results look OK, but the
> Test Results window now does not show any output.

From a quick search it seems that the affected files are */src/*build-impl.xsl files in avatar.js.project, j2ee.ejbjarproject,j2ee.clientproject, j2ee.archive, java.j2seproject, profiler.j2ee, profiler.j2se and web.project modules and nbbuild/templates/common.xml. I am not really sure how to proceed with this though. Should I completely remove any reference from these files or just replace showoutput="true" with showoutput="false"? What would be most acceptable solution as to not break any of the scripts? Any suggestion is more than welcomed.

> 
> Why does the JUnit Ant logger rely on showoutput="true", i.e. capture stdio
> from log messages? It could get stdio from TEST-*.xml#/testsuite/(system-out
> or system-err) after the test completes, and/or find the logged messages
> starting with "------------- Standard Output ---------------" or
> "------------- Standard Error -----------------" and ending with
> "------------- ---------------- ---------------". With that improvement,
> showoutput="true" could be removed from various scripts, making for much
> better readability of test results in the Output Window, especially for
> tests printing long logs.

I think that http://hg.netbeans.org/core-main/rev/da15e11ccfa4 takes care of that.

When showoutput="true" is either completely removed or changed to showoutput="false" the output window looks OK, no duplication of log messages and stacktraces also shown, and TRW also shows the output.
Comment 2 Martin Balin 2016-07-07 07:15:22 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss