Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 522475 - Add support for JUnit 5
Summary: Add support for JUnit 5
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Tycho (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Jan Sievers CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 495353
Blocks:
  Show dependency tree
 
Reported: 2017-09-19 04:47 EDT by Jan Sievers CLA
Modified: 2021-04-28 16:53 EDT (History)
12 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Sievers CLA 2017-09-19 04:47:48 EDT
JUnit 5 was released on Sep 10
http://junit.org/junit5/docs/current/user-guide/#release-notes-5.0.0

and eclipse JDT/UI has added suppport for it in Oxygen and Photon
https://wiki.eclipse.org/JDT_UI/JUnit_5

we depend on surefire to implement support for JUnit5 

https://issues.apache.org/jira/browse/SUREFIRE-1330

As soon as JUnit 5 support in surefire is available, tycho-surefire should adopt it.

Looks like several PRs are already in. Not sure what the current state is but it may make sense to start looking into this so we can get an idea how much work is expected on the Tycho side.

Looks like we need to use the junit5 branch for now
https://github.com/apache/maven-surefire/commits/junit5
Comment 2 Jan Sievers CLA 2017-12-15 09:37:37 EST
Because the sample project
https://github.com/junit-team/junit5-samples/tree/r5.0.2/junit5-maven-consumer

uses surefire 2.19.1, I believe fixing bug 495353 is a prerequisite before we can start working on JUnit 5 support

I just proposed a new patchset for bug 495353 to see if we can update surefire to 2.19.1
Comment 3 Martin Schreiber CLA 2017-12-21 01:47:19 EST
I created a piggyback CQ for using JUnit5 artifacts in Tycho: CQ 15263
Comment 4 Martin Schreiber CLA 2017-12-21 01:50:27 EST
(In reply to Martin Schreiber from comment #3)
> I created a piggyback CQ for using JUnit5 artifacts in Tycho: CQ 15263

https://dev.eclipse.org/ipzilla/show_bug.cgi?id=15263
Comment 5 Jan Sievers CLA 2017-12-21 03:00:23 EST
depending on how we implement this, we will probably also need CQs for new surefire artifacts like
https://github.com/junit-team/junit5-samples/blob/8613a50163f6fddb041c425a8a7d9971065978d2/junit5-maven-consumer/pom.xml#L51-L55
Comment 6 Martin Schreiber CLA 2017-12-21 03:21:37 EST
(In reply to Jan Sievers from comment #5)
> depending on how we implement this, we will probably also need CQs for new
> surefire artifacts like
> https://github.com/junit-team/junit5-samples/blob/
> 8613a50163f6fddb041c425a8a7d9971065978d2/junit5-maven-consumer/pom.xml#L51-
> L55

IHMO the surefire-provider is also included in the original CQ: https://dev.eclipse.org/ipzilla/show_bug.cgi?id=13321

But to be sure I asked in our CQ if it's included.
Comment 7 Martin Schreiber CLA 2017-12-21 03:24:07 EST
Draft: https://git.eclipse.org/r/#/c/114532/
Comment 8 Eclipse Genie CLA 2018-03-27 11:36:13 EDT
New Gerrit change created: https://git.eclipse.org/r/120281
Comment 9 Eclipse Genie CLA 2018-03-29 09:41:11 EDT
New Gerrit change created: https://git.eclipse.org/r/120440
Comment 11 Jan Sievers CLA 2018-03-29 10:36:35 EDT
according to
http://download.eclipse.org/tools/orbit/downloads/drops/R20180206163158/

junit-platform-launcher
junit-platform-engine
junit-platform-commons
junit-jupiter-engine
junit-vintage-engine
opentest4j

are covered by CQ 13321 for which I created a piggy-back CQ

only CQ left to create is for junit-platform-surefire-provider
Comment 12 Jan Sievers CLA 2018-03-29 10:40:52 EDT
(In reply to Jan Sievers from comment #11)
> only CQ left to create is for junit-platform-surefire-provider

https://dev.eclipse.org/ipzilla/show_bug.cgi?id=16028
Comment 13 Kamil CLA 2018-04-03 06:11:30 EDT
It seems that Junit5 launcher is not being added to Gradle projects:
https://github.com/eclipse/buildship/issues/668#issuecomment-378133705
Comment 14 Jan Sievers CLA 2018-04-04 16:38:03 EDT
(In reply to Kamil   from comment #13)
> It seems that Junit5 launcher is not being added to Gradle projects:
> https://github.com/eclipse/buildship/issues/668#issuecomment-378133705

I don't think this issue is directly related to JUnit 5 support in tycho (as opposed to JUnit 5 support in eclipse).

For the record though, the proposal https://git.eclipse.org/r/120281
brings all libs required to run Junit 5 (and JUnit 4) tests:

junit-platform-surefire-provider
junit-platform-launcher
junit-platform-engine
junit-platform-commons
junit-jupiter-engine
junit-vintage-engine
opentest4j

out of the box, that means there is no need for the test project to directly require any of these libs. Only junit-jupiter-api is directly required by the test project.

From what I understand these libs should be independent of junit-jupiter-api so you could even use a newer version of junit-jupiter-api with the same (older) engine version. For now we are using version 5.0/platform 1.0 as this is what is also currently shipped with eclipse. Still need to check though what happens if we use e.g. junit-jupiter-api 5.1 with unchanged engine version 5.0
Comment 15 Eclipse Genie CLA 2018-04-06 10:56:20 EDT
New Gerrit change created: https://git.eclipse.org/r/120857
Comment 17 Kamil CLA 2018-04-07 04:26:28 EDT
Jan Sievers, sorry, I focused on "support for JUnit 5" and missed the "Product" label.
Please tell me, since this commit is on master now ( http://git.eclipse.org/c/tycho/org.eclipse.tycho.git/commit/?id=065ce8f0f5c4c344fc914a8eb18eae0353ead620 )
Does this affect JUnit 5 support in Eclipse as well, or I should fill separate issue?
Comment 18 Jan Sievers CLA 2018-04-09 03:45:50 EDT
(In reply to Kamil   from comment #17)
> Jan Sievers, sorry, I focused on "support for JUnit 5" and missed the
> "Product" label.
> Please tell me, since this commit is on master now (
> http://git.eclipse.org/c/tycho/org.eclipse.tycho.git/commit/
> ?id=065ce8f0f5c4c344fc914a8eb18eae0353ead620 )
> Does this affect JUnit 5 support in Eclipse as well, or I should fill
> separate issue?

support for JUnit 5 in eclipse is a separate thing. Probably best filed under jdt.ui
Comment 19 Lars Vogel CLA 2018-04-09 03:56:07 EDT
(In reply to Jan Sievers from comment #18)
> support for JUnit 5 in eclipse is a separate thing. Probably best filed
> under jdt.ui

Eclipse 4.7 already supports JUnit 5. See https://www.eclipse.org/community/eclipse_newsletter/2017/october/article5.php
Comment 20 Dani Megert CLA 2018-04-09 04:16:18 EDT
(In reply to Lars Vogel from comment #19)
> (In reply to Jan Sievers from comment #18)
> > support for JUnit 5 in eclipse is a separate thing. Probably best filed
> > under jdt.ui
> 
> Eclipse 4.7 already supports JUnit 5. See
> https://www.eclipse.org/community/eclipse_newsletter/2017/october/article5.php
> 

You need at least 4.7.1a. Best is to use 4.7.3.
Comment 21 Kamil CLA 2018-04-09 05:14:05 EDT
Guys, I'm using 4.7.3 and as I've written in my comment:

> It seems that Junit5 launcher is not being added to Gradle projects:
https://github.com/eclipse/buildship/issues/668#issuecomment-378133705

Then Jan answered:

> For the record though, the proposal https://git.eclipse.org/r/120281
brings all libs required to run Junit 5 (and JUnit 4) tests

so my question is: does this commit affects Eclipse IDE as well, or only Tycho?
Comment 22 Jan Sievers CLA 2018-04-09 05:48:02 EDT
(In reply to Kamil   from comment #21)
> so my question is: does this commit affects Eclipse IDE as well, or only
> Tycho?

the commit 

http://git.eclipse.org/c/tycho/org.eclipse.tycho.git/commit?id=065ce8f0f5c4c344fc914a8eb18eae0353ead620

only affects Tycho
Comment 24 Eclipse Genie CLA 2018-04-26 04:36:47 EDT
New Gerrit change created: https://git.eclipse.org/r/121775