Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 546632

Summary: Test in UIAllTests are not independent, failures when test run individual
Product: [Eclipse Project] Platform Reporter: Rolf Theunissen <rolf.theunissen>
Component: UIAssignee: Rolf Theunissen <rolf.theunissen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: akurtakov, Lars.Vogel
Version: 4.11   
Target Milestone: 4.12 M3   
Hardware: PC   
OS: Windows 7   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=422676
https://git.eclipse.org/r/141177
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=455d73468782b4a6d4d989cf76ead1a08f7a4f08
Whiteboard:

Description Rolf Theunissen CLA 2019-04-22 14:30:26 EDT
Many of the test part of UIAllTests fail when run individually. The easiest to validate this is to comment out the InjectionEventTest and run the test suite.
Or re-run just on test class from the JUnit UI.
The problem is related to the observations in Bug 422676.

The tests start running correctly when, the following code is added after the context is constructed:

appContext.set(UISynchronize.class, ...);       // Required for the next line
ContextInjectionFactory.setDefault(appContext); // Required to make the test run properly

And in the cleanup code:
ContextInjectionFactory.setDefault(null);

It should be validated that each class can run individually.
Comment 1 Lars Vogel CLA 2019-04-23 04:58:00 EDT
*** Bug 542505 has been marked as a duplicate of this bug. ***
Comment 2 Eclipse Genie CLA 2019-04-25 15:17:29 EDT
New Gerrit change created: https://git.eclipse.org/r/141177
Comment 4 Lars Vogel CLA 2019-04-30 03:42:28 EDT
Rolf, please remember to assign the bug to you and set the milestone if you provide a fix for it.
Comment 5 Lars Vogel CLA 2019-04-30 03:45:52 EDT
(In reply to Lars Vogel from comment #4)
> Rolf, please remember to assign the bug to you and set the milestone if you
> provide a fix for it.

Thanks for the fix.
Comment 6 Alexander Kurtakov CLA 2019-05-16 05:45:19 EDT
Marking this one as fixed. Please reopen in case you're aware of more tests failing individually.