Bug 576995 - [junit 5] Add @Suite support from JUnit 5.8.1
Summary: [junit 5] Add @Suite support from JUnit 5.8.1
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.21   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 4.22 RC1   Edit
Assignee: Jeff Johnston CLA
QA Contact:
URL:
Whiteboard:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2021-11-01 14:13 EDT by Jeff Johnston CLA
Modified: 2022-01-05 15:15 EST (History)
5 users (show)

See Also:
noopur_gupta: review+
Vikas.Chandra: review+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Johnston CLA 2021-11-01 14:13:06 EDT
JUnit 5.8.1 now supports the @Suite annotation for a class with additional annotations such as @SelectClasses, @SelectPackages, @SuiteDisplayName.
Comment 1 Eclipse Genie CLA 2021-11-01 14:18:34 EDT Comment hidden (obsolete)
Comment 2 Eclipse Genie CLA 2021-11-02 13:12:03 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/187237
Comment 3 Eclipse Genie CLA 2021-11-02 13:28:32 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.releng.aggregator/+/187238
Comment 4 Jeff Johnston CLA 2021-11-02 13:54:25 EDT
The module org.junit.platform.suite.engine has been newly added in JUnit 5.8.1 and needs to be added for JDT code to run testsuites using the @Suite annotation provided in org.junit.platform.suite.api.

The module will need to be added to PDE as well. I based the gerrit changes on Noopur's changes for bug 576389.  Adding Vikas in cc to check and update at the same time.  First gerrit below (187217) was a WIP which I have removed.

There were no Orbit changes from the last JUnit 5.8.1 addition of junit.platform.suite.commons so I didn't make any forceQualifierUpdate.txt changes to equinox or platform.commons
Comment 5 Noopur Gupta CLA 2021-11-03 09:48:04 EDT
Adding Julian also in cc as Vikas is away this week.
Comment 6 Julian Honnen CLA 2021-11-03 12:05:38 EDT
> I have it working for "Run as Junit Test", but I can't get it working for "Run
> as Junit Test Plugin".  In the 2nd case it finds the junit-platform-suite-engine 
> but cannot find another test engine.  I have tried adding junit-jupiter-engine
> to the plug-in's .classpath, it's dependencies, and as a JVM parameter for the
> launch configuration, but still I get a message that the
> junit-platform-suite-engine did not find another test engine.

That is a bug in PDE. It only correctly adds all bundles containing TestEngines to the test classpath, when the test is launched with -runasjunit5 (RemotePluginTestRunner::main). That's only the case for tests containing @RunWith(JUnitPlatform.class). I assume this behavior also breaks third-party TestEngines.

I think we should remove this argument and always add those bundles to the classpath. That seems to work fine at first glance.

Once org.junit.platform.suite.engine is available in an I-Build I can fix that.
Comment 7 Jeff Johnston CLA 2021-11-04 11:24:09 EDT
(In reply to Julian Honnen from comment #6)
> > I have it working for "Run as Junit Test", but I can't get it working for "Run
> > as Junit Test Plugin".  In the 2nd case it finds the junit-platform-suite-engine 
> > but cannot find another test engine.  I have tried adding junit-jupiter-engine
> > to the plug-in's .classpath, it's dependencies, and as a JVM parameter for the
> > launch configuration, but still I get a message that the
> > junit-platform-suite-engine did not find another test engine.
> 
> That is a bug in PDE. It only correctly adds all bundles containing
> TestEngines to the test classpath, when the test is launched with
> -runasjunit5 (RemotePluginTestRunner::main). That's only the case for tests
> containing @RunWith(JUnitPlatform.class). I assume this behavior also breaks
> third-party TestEngines.
> 
> I think we should remove this argument and always add those bundles to the
> classpath. That seems to work fine at first glance.
> 
> Once org.junit.platform.suite.engine is available in an I-Build I can fix
> that.

Thanks Julian.  I have updated the eclipse-sdk-prereqs.target patch as it had a merge conflict due to another patch merged for updating ant.  Are you able to review that patch or should we wait and leave it for Vikas?
Comment 8 Julian Honnen CLA 2021-11-04 11:41:52 EDT
I think you also need to add the bundle to the jdt feature.
Comment 10 Lars Vogel CLA 2021-11-05 04:08:49 EDT
Unfortunately Eclipse SDK tests cannot use Junit 5, see Bug 531057.
Comment 11 Eclipse Genie CLA 2021-11-05 08:30:11 EDT
New Gerrit change created: https://git.eclipse.org/r/c/pde/eclipse.pde.ui/+/187392
Comment 13 Eclipse Genie CLA 2021-11-08 01:48:37 EST
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt/+/187496
Comment 15 Noopur Gupta CLA 2021-11-08 03:46:21 EST
(In reply to Eclipse Genie from comment #14)
> Gerrit change https://git.eclipse.org/r/c/jdt/eclipse.jdt/+/187496 was
> merged to [master].
> Commit:
> http://git.eclipse.org/c/jdt/eclipse.jdt.git/commit/?id=56dc8fed5147bf75dd4619f4b7ef7107907f5d3f
Added org.junit.platform.suite.engine to JDT feature.
Comment 16 Eclipse Genie CLA 2021-11-08 10:51:03 EST Comment hidden (obsolete)
Comment 17 Eclipse Genie CLA 2021-11-08 15:45:49 EST
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/187528
Comment 19 Noopur Gupta CLA 2021-11-12 05:29:00 EST
(In reply to Eclipse Genie from comment #18)
> Gerrit change https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/187528 was
> merged to [master].
> Commit:
> http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=b1ebfbadb6953ca4946354dd181423da33694be5
+1 for the JDT part to be included in RC1.
Comment 21 Kalyan Prasad Tatavarthi CLA 2021-11-19 00:27:16 EST
@Jeff can this bug be closed now? If so, please resolve this bug.
Comment 22 Jeff Johnston CLA 2021-11-19 16:07:53 EST
Released for 4.22 RC1
Comment 23 Jeff Johnston CLA 2022-01-05 15:15:59 EST
Verified for 4.22 RC2