Bug 553836 - [Tests] Remove UITestCase dependency on TestCase
Summary: [Tests] Remove UITestCase dependency on TestCase
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.13   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on: 553832 553833 553834 553835
Blocks:
  Show dependency tree
 
Reported: 2019-12-05 14:35 EST by Rolf Theunissen CLA
Modified: 2020-04-20 13:00 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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