Bug 553836

Summary: [Tests] Remove UITestCase dependency on TestCase
Product: [Eclipse Project] Platform Reporter: Rolf Theunissen <rolf.theunissen>
Component: UIAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: Lars.Vogel, paul-eclipse
Version: 4.13Keywords: helpwanted
Target Milestone: ---   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/159947
https://git.eclipse.org/r/159976
https://git.eclipse.org/c/platform/eclipse.platform.releng.git/commit/?id=bd3b0611772e07a2c8354483dd2b44e9b35649e2
https://git.eclipse.org/r/159979
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=0b538451c8adaa1552d9ccc2e7d24b0f64c98835
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=151264c783819749bf5583ca85a09eb8988eb367
https://git.eclipse.org/r/160008
https://git.eclipse.org/r/160866
https://git.eclipse.org/r/160867
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=60ffba80379c2c19c6552f90f10d76e90a40f95f
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=941d04c13d960e852b90c4859106073258631ee9
Whiteboard:
Bug Depends on: 553832, 553833, 553834, 553835    
Bug Blocks:    

Description Rolf Theunissen CLA 2019-12-05 14:35:46 EST
UITestCase still extends the JUnit3 TestCase. This dependency should be removed when all tests are migrated to JUnit4.
Comment 1 Eclipse Genie CLA 2020-03-24 09:42:05 EDT
New Gerrit change created: https://git.eclipse.org/r/159947
Comment 2 Eclipse Genie CLA 2020-03-25 03:14:21 EDT
New Gerrit change created: https://git.eclipse.org/r/159976
Comment 4 Eclipse Genie CLA 2020-03-25 04:51:41 EDT
New Gerrit change created: https://git.eclipse.org/r/159979
Comment 7 Eclipse Genie CLA 2020-03-25 14:45:07 EDT
New Gerrit change created: https://git.eclipse.org/r/160008
Comment 8 Rolf Theunissen CLA 2020-04-14 01:47:36 EDT
(In reply to Eclipse Genie from comment #6)
> Gerrit change https://git.eclipse.org/r/159947 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/
> ?id=151264c783819749bf5583ca85a09eb8988eb367

This causes that many test-windows are only closed at the end of all tests, not when a test is finished.

I have a solution ready, will push it shortly.
Comment 9 Rolf Theunissen CLA 2020-04-14 02:19:03 EDT
Also note that test tracing and checks for blocking shells are lost when just removing the dependency on UITestCase.
Comment 10 Paul Pazderski CLA 2020-04-14 05:41:59 EDT
Why remove UITestCase at all? I don't see the connection to removing TestCase. I've always loved that most tests got a common base class and had preferred to go in the opposite direction.
Comment 11 Lars Vogel CLA 2020-04-14 05:55:59 EDT
(In reply to Paul Pazderski from comment #10)
> Why remove UITestCase at all? I don't see the connection to removing
> TestCase. I've always loved that most tests got a common base class and had
> preferred to go in the opposite direction.

I think the JUnit4 way is to use rules to model common requirements instead of a using a base class.
Comment 12 Rolf Theunissen CLA 2020-04-14 06:15:21 EDT
(In reply to Lars Vogel from comment #11)
> (In reply to Paul Pazderski from comment #10)
> > Why remove UITestCase at all? I don't see the connection to removing
> > TestCase. I've always loved that most tests got a common base class and had
> > preferred to go in the opposite direction.
> 
> I think the JUnit4 way is to use rules to model common requirements instead
> of a using a base class.

I did create the rule, and push it to Gerrit. However it is not attached to this bug yet.
https://git.eclipse.org/r/160867/

I think that the functionality of UITestCase can be expressed with 4 rules:
- Tracing
- Close test windows
- Reset preferences
- Check for modal shells
and some static functions for all utility functions.

To have a common base class that includes the base rules or to have rules in each test case, is a matter of code style.
Comment 13 Paul Pazderski CLA 2020-04-14 06:29:51 EDT
Which are gone in Junit5 and than again you have to rewrite everything for Junit Extensions.
I'll not become a fan of replacing something that works with something else that work basically the same. For the old base class was (almost) no way to open a test window without having the closing mechanism in place. The rule can simply be ignored or forgotten.

@Rolf: a common junit rule is TempFolder (or however it is actually named) which is used to create folders and later to remove them. To tackle my complain above I would suggest to change your CloseTestWindowRule in a TestWindowRule and include the open stuff instead of making the UITestCase methods static. As said, if I can open the test window with a static method why should I bother searching for the closing rule.
Comment 14 Eclipse Genie CLA 2020-04-14 09:56:41 EDT
New Gerrit change created: https://git.eclipse.org/r/160866
Comment 15 Eclipse Genie CLA 2020-04-14 09:56:45 EDT
New Gerrit change created: https://git.eclipse.org/r/160867