Bug 219077 - JUnit plug-in tests swallow unhandled event loop exceptions
Summary: JUnit plug-in tests swallow unhandled event loop exceptions
Status: CLOSED WONTFIX
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: PDE-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-15 06:59 EST by Martin Oberhuber CLA
Modified: 2019-07-07 14:53 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Oberhuber CLA 2008-02-15 06:59:00 EST
Created from bug 219069.

JUnit plug-in tests that are run unattended, as part of release engineering builds, do not give any feedback about unhandled event loop exceptions (unless one would investigate the Workbench .log file in the workspace).

This makes it hard to find and diagnose problems in unit tests, which are really caused by some completely different component; it also lets potential problems in the event loop unnoticed, which would otherwise surface and be found more easily.

This report is created from bug 219069, where a unit test called JobManager.join() which runs in a nested event loop. In the event loop, an exception occurred which eventually made the test fail; but the reason for failure was very hard to find, because the event loop exception is only logged to the Workbench Log. I think the exception should also surface to the test runner, at least as part of the console output.

What happens internally, is that PDE Unittest creates a UITestApplication;
  this creates a nested IDEApplication; 
  the IDEApplication creates an IDEWorkbenchAdvisor;
  the IDEWorkbenchAdvisor uses default functionality in
    WorkbenchAdvisor.eventLoopException()
which just logs the error by default.

I think that the UITestApplication should register a modified status handler which not only logs the error, but also prints it to stdout or throws it into the calling unit test. Being able to set such a status handler might require and API change.

Workaround: in the Launch for PDE Unittests, enable tracing for
   org.eclipse.ui.workbench/debug
or run unattended builds with -debug and a related .options file. The drawback of this workaround is, that (a) the exception is only printed so it's not really handled by the unittest framework; and, (b) switching on Debug Mode for the Workbench might have other unwanted side-effects.
Comment 1 Remy Suen CLA 2008-02-15 08:14:52 EST
Does adding -consoleLog as a program argument help make the errors show up in the Eclipse console?
Comment 2 Martin Oberhuber CLA 2008-02-15 11:34:33 EST
Yes, -consoleLog is another workaround that makes the .log visible on stdout so it's visible to the unit tests.

My concern is only that on the test overview pages, or when deciding whether a test has failed or not, the console logs are typically not considered. Only failed tests vs. not failed tests are considered. 

Therefore, unless somebody implements a pattern matcher that reads the consoleLog and converts it into AssertionFailedErrors for junit, I'd prefer a clean solution with a custom handler registered fore eventLoopException, such that these are treated properly by JUnit.
Comment 3 Eclipse Genie CLA 2019-07-07 14:53:27 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.