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

JUnit 5 Support #4433

Closed
blorente opened this issue Feb 13, 2023 · 5 comments
Closed

JUnit 5 Support #4433

blorente opened this issue Feb 13, 2023 · 5 comments
Assignees
Labels
product: IntelliJ IntelliJ plugin stale Issues or PRs that are stale (no activity for 30 days) topic: testing type: feature request

Comments

@blorente
Copy link
Collaborator

blorente commented Feb 13, 2023

Description of the feature request:

Bazel 6 supports JUnit 5 for Java tests. Furthermore, some third party rulesets (e.g. contrib_rules_jvm already offer facilities to allow it.

As far as I can tell, the plugin does not yet offer support for these tests.
I've given the implementation a shot in this branch: https://github.com/blorente/intellij/tree/blorente/junit5 (leveraging the existing testbed: commit, but it looks like it will need at least a few days more of investment.

What underlying problem are you trying to solve with this feature?

Currently, the plugin accidentally supports some of its features. As far as I can tell, I can:

  • Right-click run a test, and most of the time it will be run correctly (but with the JUnit4 runner)
  • Import JUnit 5 as a library, and get autocompletion and symbol resolution.

The plugin does not, however:

  • Recognize a file as JUnit 5 for the purposes of gutter annotation:

JUnit 4:
Screenshot 2023-02-13 at 13 33 23

JUnit 5 (missing the icons):
Screenshot 2023-02-13 at 13 33 14

  • I suspect (but haven't validated yet) that it doesn't support a JUnit 5 runner either.
  • And looking through the code, I found a lot of references to JUnit 4 and 3 and none to JUnit 5, which makes me believe that any JUnit 5 support is provided by IntelliJ itself and not the plugin.

What operating system, Intellij IDE and programming languages are you using? Please provide specific versions.

I use an arm macOS. This reproduces in IntelliJ UE 2022.2 and 2022.3, on the plugin's master branch.

Have you found anything relevant by searching the web?

Any other information, logs, or outputs that you want to share?

I'm happy to work on this. The main reason for the ticket is to make sure nobody is looking into it before sinking significant time.

@sgowroji sgowroji added type: feature request product: IntelliJ IntelliJ plugin topic: testing awaiting-maintainer Awaiting review from Bazel team on issues labels Feb 13, 2023
@mai93 mai93 assigned blorente and unassigned mai93 Feb 15, 2023
@rdesgroppes
Copy link

rdesgroppes commented Feb 16, 2023

Did you replace java_test by java_junit5_test?
💡 use v0.9.0 of bazel_contrib/rules_jvm (released Oct 27, 2022), or any next one without problem selecting method names nor recognizing parameterized tests.
Once done, it should work pretty well:
image

@blorente
Copy link
Collaborator Author

Fixed by #4473

@blorente
Copy link
Collaborator Author

@rdesgroppes Thanks for the pointer! I've added a junit5 example to the example repository, using contrib_rules_jvm.

After looking at it, it looks like JUnit 5 and JUnit 4 share a lot of the test filtering language (which is the main responsibility of the bazel plugin), so most of the work was in making the tests tests against junit 5, and making the code support it explicitly instead of accidentally.

@blorente blorente removed the awaiting-maintainer Awaiting review from Bazel team on issues label Mar 23, 2023
@github-actions
Copy link

Thank you for contributing to the IntelliJ repository! This issue has been marked as stale since it has not had any activity in the last 6 months. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-maintainer". Please reach out to the triage team (@bazelbuild/triage) if you think this issue is still relevant or you are interested in getting the issue resolved.

@github-actions github-actions bot added the stale Issues or PRs that are stale (no activity for 30 days) label Sep 23, 2023
@github-actions
Copy link

github-actions bot commented Oct 7, 2023

This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please reach out to the triage team (@bazelbuild/triage). Thanks!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product: IntelliJ IntelliJ plugin stale Issues or PRs that are stale (no activity for 30 days) topic: testing type: feature request
Projects
Development

No branches or pull requests

4 participants