This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 531057 - [JUnit 5] Add JUnit 5 support for automated tests
Summary: [JUnit 5] Add JUnit 5 support for automated tests
Status: CLOSED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Releng (show other bugs)
Version: 4.7   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.24 M1   Edit
Assignee: Platform-Releng-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 537975 (view as bug list)
Depends on:
Blocks: 534803
  Show dependency tree
 
Reported: 2018-02-12 10:42 EST by Lucas Bullen CLA
Modified: 2022-12-14 05:07 EST (History)
14 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lucas Bullen CLA 2018-02-12 10:42:01 EST
Add support for JUnit 5 tests in org.eclipse.test.EclipseTestRunner.
Comment 1 Lucas Bullen CLA 2018-02-12 10:43:20 EST
Currently being held up implementing JUnit's tutorial: https://github.com/junit-team/junit5/issues/1294
Comment 2 Noopur Gupta CLA 2018-02-13 13:22:56 EST
See also bug 520811 which had a similar issue:
org.junit.platform.commons.util.PreconditionViolationException: Cannot create Launcher without at least one TestEngine; consider adding an engine implementation JAR to the classpath

You can check JDT's test runner org.eclipse.jdt.internal.junit.runner.RemoteTestRunner and PDE's test runner org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner for implementation details.

Can you reproduce it with a new plug-in project? If so, attach the sample project with steps to reproduce.
Comment 3 Eclipse Genie CLA 2018-06-27 16:28:18 EDT
New Gerrit change created: https://git.eclipse.org/r/125130
Comment 5 Eclipse Genie CLA 2018-07-17 08:48:26 EDT
New Gerrit change created: https://git.eclipse.org/r/126172
Comment 7 Eclipse Genie CLA 2018-07-17 14:22:49 EDT
New Gerrit change created: https://git.eclipse.org/r/126199
Comment 9 Eclipse Genie CLA 2018-07-21 11:17:17 EDT
New Gerrit change created: https://git.eclipse.org/r/126429
Comment 11 Vikas Chandra CLA 2018-07-26 04:40:45 EDT
Sravan, can you please look at

https://bugs.eclipse.org/bugs/show_bug.cgi?id=534803#c50
Comment 12 Eclipse Genie CLA 2018-08-13 10:06:31 EDT
New Gerrit change created: https://git.eclipse.org/r/127349
Comment 14 Eclipse Genie CLA 2018-08-14 05:40:59 EDT
New Gerrit change created: https://git.eclipse.org/r/127385
Comment 16 Eclipse Genie CLA 2018-08-14 08:29:35 EDT
New Gerrit change created: https://git.eclipse.org/r/127409
Comment 18 Eclipse Genie CLA 2018-08-14 11:08:10 EDT
New Gerrit change created: https://git.eclipse.org/r/127420
Comment 19 Alexander Kurtakov CLA 2018-08-15 02:07:53 EDT
Just found out that tests using assumptions to prevent running are failing when run with JUnit 5.
Comment 20 Andrey Loskutov CLA 2018-08-15 02:13:38 EDT
(In reply to Alexander Kurtakov from comment #19)
> Just found out that tests using assumptions to prevent running are failing
> when run with JUnit 5.

Is this the reason for ~200 test fails in every platform build?
Comment 21 Alexander Kurtakov CLA 2018-08-15 02:37:29 EDT
(In reply to Andrey Loskutov from comment #20)
> (In reply to Alexander Kurtakov from comment #19)
> > Just found out that tests using assumptions to prevent running are failing
> > when run with JUnit 5.
> 
> Is this the reason for ~200 test fails in every platform build?

I have found it via the 65 errors in swt suite on gtk2 (all caused by that) and I assume there are more such cases.
Comment 22 Dani Megert CLA 2018-08-15 05:35:11 EDT
(In reply to Alexander Kurtakov from comment #21)
> I have found it via the 65 errors in swt suite on gtk2 (all caused by that)
> and I assume there are more such cases.

Right.


There also seems to be some infra/setup issue: JDT Compiler tests fail badly either with

No Eclipse compiler found 
or
java.lang.NullPointerException

Looks like it's not finding the compiler.
Comment 23 Alexander Kurtakov CLA 2018-08-15 05:46:46 EDT
(In reply to Dani Megert from comment #22)
> (In reply to Alexander Kurtakov from comment #21)
> > I have found it via the 65 errors in swt suite on gtk2 (all caused by that)
> > and I assume there are more such cases.
> 
> Right.
> 
> 
> There also seems to be some infra/setup issue: JDT Compiler tests fail badly
> either with
> 
> No Eclipse compiler found 
> or
> java.lang.NullPointerException
> 
> Looks like it's not finding the compiler.

There is a patch for that from Lucas https://git.eclipse.org/r/#/c/127420/ but it's up to JDT committer to determine whether this is right fix (Jay is set as reviewer).
Comment 24 Eclipse Genie CLA 2018-08-15 11:07:57 EDT
New Gerrit change created: https://git.eclipse.org/r/127452
Comment 25 Eclipse Genie CLA 2018-08-15 11:14:12 EDT
New Gerrit change created: https://git.eclipse.org/r/127453
Comment 26 Eclipse Genie CLA 2018-08-15 11:40:28 EDT
New Gerrit change created: https://git.eclipse.org/r/127455
Comment 31 Stephan Herrmann CLA 2018-08-15 13:33:04 EDT
(In reply to Eclipse Genie from comment #30)
> Gerrit change https://git.eclipse.org/r/127420 was merged to [master].
> Commit:
> http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/
> ?id=6432fdd58a28b72dc3736bdded436559d4f912d6

Pushed directly (after two gerrit runs failed with different, unrelated issues).
This should fix the new failures in jdt.core tests.
Comment 32 Vikas Chandra CLA 2018-08-16 01:36:20 EDT
On most platforms, many pde api tools junit tests are failing with 

testInvalidClassMethodTag2F	Failure	Java heap space

java.lang.OutOfMemoryError: Java heap space

See 537976.

Is this related to changes on this bug?
Comment 33 Vikas Chandra CLA 2018-08-16 01:36:50 EDT
See bug 537976
Comment 34 Stephan Herrmann CLA 2018-08-16 08:27:51 EDT
*** Bug 537975 has been marked as a duplicate of this bug. ***
Comment 35 Tobias Pongs CLA 2018-10-24 01:37:05 EDT
It seems fragment tests are broken.

The EclipseTestRunner previously contained the method "loadSuiteClass" which handled fragment bundles correctly. In the new ClassLoaderTools there is no special code for fragments.
Comment 36 Andrey Loskutov CLA 2018-10-26 17:13:25 EDT
(In reply to Tobias Pongs from comment #35)
> It seems fragment tests are broken.
> 
> The EclipseTestRunner previously contained the method "loadSuiteClass" which
> handled fragment bundles correctly. In the new ClassLoaderTools there is no
> special code for fragments.

Can you point to concrete tests please? I guess the fix should be in org.eclipse.test.ClassLoaderTools.getPluginClassLoader(String, ClassLoader), where the bundle is resolved?
Comment 37 Tobias Pongs CLA 2018-10-29 04:23:23 EDT
(In reply to Andrey Loskutov from comment #36)
> (In reply to Tobias Pongs from comment #35)
> > It seems fragment tests are broken.
> > 
> > The EclipseTestRunner previously contained the method "loadSuiteClass" which
> > handled fragment bundles correctly. In the new ClassLoaderTools there is no
> > special code for fragments.
> 
> Can you point to concrete tests please? I guess the fix should be in
> org.eclipse.test.ClassLoaderTools.getPluginClassLoader(String, ClassLoader),
> where the bundle is resolved?

I don't know some tests. I only have many tests in my own projects, which are not publicly available.
When switching to the new 2018-09 release, I recognized, that my fragment tests could not be started.
Comment 38 Mattias Bertilsson CLA 2019-12-09 11:18:05 EST
The changes committed to fix this issue removes support for the "formatter=" argument to EclipseTestRunner and hence the org.eclipse.test.coretestapplication and uitestapplications (or to be specific, the output file name part of the argument is read, but the actual formatter part is ignored).

While that may be good enough for Eclipse platform release engineering itself, there are Eclipse based products out there that use the Eclipse Test Framework to drive their tests and rely on options like these.

Is anyone still working on this? Would it be possible to bring back support for formatter selection?
Comment 39 Lars Vogel CLA 2021-01-28 15:23:16 EST
Any more work planned in this bug or can we close it?
Comment 40 Alexander Kurtakov CLA 2021-01-29 02:33:34 EST
(In reply to Lars Vogel from comment #39)
> Any more work planned in this bug or can we close it?

Not sure. Do you have the time to migrate some small test bundle to JUnit 5 but keep the JUnit 4 TestSuite used in test.xml so it continues being found and run by testframewok.
Comment 41 Lars Vogel CLA 2021-01-29 03:08:12 EST
(In reply to Alexander Kurtakov from comment #40)
> (In reply to Lars Vogel from comment #39)
> > Any more work planned in this bug or can we close it?
> 
> Not sure. Do you have the time to migrate some small test bundle to JUnit 5
> but keep the JUnit 4 TestSuite used in test.xml so it continues being found
> and run by testframewok.

We can try with Bug 531057.
Comment 42 Lars Vogel CLA 2021-02-03 11:35:57 EST
org.eclipse.e4.ui.tests.css.core has been migrated to JUnit 5, so I guess we can close this one.
Comment 43 Alexander Kurtakov CLA 2021-02-03 11:52:37 EST
(In reply to Lars Vogel from comment #42)
> org.eclipse.e4.ui.tests.css.core has been migrated to JUnit 5, so I guess we
> can close this one.

Unfortunately execution didn't succeed https://download.eclipse.org/eclipse/downloads/drops4/I20210202-1840/testresults/xml/org.eclipse.e4.ui.tests.css.core_ep419I-unit-cen64-gtk3-java15_linux.gtk.x86_64_15.xml  tests="0" . Still has to be investigated what went wrong.
Comment 44 Lars Vogel CLA 2021-08-19 04:46:31 EDT
JUnit 5 will support soon test suites.
Comment 45 Eclipse Genie CLA 2021-11-03 11:22:36 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.releng/+/187276
Comment 47 Lars Vogel CLA 2021-11-05 06:55:16 EDT
I'm trying to debug why Junit 5 tests are not executed but running out of time for today. Taking down my notes so that I or someone else can restart here:

To debug:

1.) Create a new Junit test class, e.g.:

-------
package org.eclipse.test;

import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.Test;

class MyTest {

	@Test
	void test() {
		fail("Not yet implemented");
	}

}

--------

2:) Create an launch configuration using org.eclipse.test.uittestapplicattion as application and use the -classname org.eclipse.test.MyTest as argument parameter

3.) Start it -> works fine

Next step would be try to point to the CSS core tests via this setup and test if they can be found if started from the IDE. Currently the Ant based build does not find them. See for example: https://download.eclipse.org/eclipse/downloads/drops4/I20211104-1800/testresults/html/org.eclipse.e4.ui.tests.css.core_ep422I-unit-cen64-gtk3-java11_linux.gtk.x86_64_11.html
Comment 48 Alexander Kurtakov CLA 2022-02-17 01:08:14 EST
Changing target platform.
Comment 49 Alexander Kurtakov CLA 2022-12-14 05:07:44 EST
All working now.