Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plug-in JUnit Launch does not detec Junit5 tests #390

Closed
Pontesegger opened this issue Nov 8, 2022 · 4 comments
Closed

Plug-in JUnit Launch does not detec Junit5 tests #390

Pontesegger opened this issue Nov 8, 2022 · 4 comments

Comments

@Pontesegger
Copy link
Contributor

Beginning from 2022-09 I am not able to execute JUnit Plug-in Tests. Works fine with 2022-06 IDE.

My Setup:

  • Tests provided within fragment project
  • Target definition based on 2022-06
  • Test fragment dependend on:
    org.junit.jupiter.api
    org.junit.jupiter.params
  • Execution environment: Java17

When installing an IDE 2022-06 I have a context menu Run As -> JUnit Plug-in Test.
Further tests execute fine and results are displayed in the JUnit view.

Now I switched to an IDE 2022-09, keeping the rest of my setup above.

Finding 1) the context menu entry Run As -> JUnit Plug-in Test is gone. To make it reappear I have to add following dependencies to my fragment:
org.junit.platform.commons;bundle-version="1.8.1",
org.junit.platform.engine;bundle-version="1.8.1",
org.junit.jupiter.engine;bundle-version="5.8.1"

Finding 2) With the context menu back I can launch Unit tests, but after execution the JUnit view shows 0 tests. Trying to run with coverage reveals that the test code is actually not executed.

Followed it down to RemoteTestRunner.java#516
The count returned is always 0, so test discovery somehow does not work.

@mickaelistria
Copy link
Contributor

This indeed seems like a bug. Platform adopted upstream junit-* bundles in last release instead of Orbit's variant org.junit.. PDE was supposed to work with both equally, but it looks like this doesn't work as well as expected.
I would recommend that -if you use a recent IDE and a recent Tycho- you simply stop using org.junit
bundles and instead use junit-* ones. PDE and Tycho would be happy with it.

@Pontesegger
Copy link
Contributor Author

Does eclipse then ship junit.* plugins? At least 2022-06 does not seem to have such plug-ins. So which kind of dependencies do you declare for IDE/tycho? Any examples?

DiamondLightSource-Gerrit-server pushed a commit to openGDA/gda-core that referenced this issue Jan 11, 2023
In preparation for consuming JUnit 5 from non Eclipse orbit bundles
replace Require-Bundle with Import-Package to allow an incremental
change.

This will be required to update the IDE to 2022-09 and beyond
(eclipse-pde/eclipse.pde#390).

Change-Id: Ic75333f332bd64535bf9d814ebcdcab1802697ab
@akurtakov
Copy link
Member

Is this still an issue?

@HannesWell
Copy link
Member

Duplicate of #650

@HannesWell HannesWell marked this as a duplicate of #650 Sep 26, 2024
@HannesWell HannesWell closed this as not planned Won't fix, can't repro, duplicate, stale Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants