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 #6681
Comments
P1 because I consider this important feature. |
No can do, at least not with the urgency that P1 bugs need although I do agree that we should do this eventually. |
Good news: The JUnit 5 team have a sample for using JUnit 5 in Bazel! :) https://github.com/junit-team/junit5-samples/tree/master/junit5-jupiter-starter-bazel |
Sure, it's not native, but it at least (should) fix the problem that the other existing example, https://github.com/JeffreyFalgout/bazel-junit5.git, doesn't work. |
Any update on a native solution for this? |
The JUnit team's Bazel starter project (https://github.com/junit-team/junit5-samples/tree/master/junit5-jupiter-starter-bazel) only appears to work with the Java 8 Bazel toolchain. This works fine (as does not specifying Specifying any other toolchain causes the The log output shows that it ran, but found no tests:
Any clues as to what could be causing this? Maybe |
Update on my issue above: |
Might be useful to clarify for any other Bazel newbies like myself what the
If you're using the new Add the
Then change the test
Might be useful to someone... |
@martindow Any luck experimenting with |
For those who curious following example worked for me in bazel 2.x |
@unoexperto I also found a solution in case you want to expose/collect the JUnit reports for Jenkins. https://github.com/salesforce/bazel-maven-proxy/tree/master/tools/junit5 |
Bump - Would be great to have first class support for this |
We have built a workaround for it: junit-team/junit5-samples#133 |
I know it is not exactly a bazel issue. Do we know if the junit folks are working on bringing junit5 support natively to bazel anytime soon . |
Any timeline for this feature? We know it's P3, but JUnit 4 becomes rather old. |
What is the timeline for this issue? Its been open since 2018. |
Bump |
So I finally figured out why the behavior @martindow noticed above is happening (that is, no tests being run for toolchains other than java8). The reason is the version of java in the This problem seems to exist in bazel versions < 4, but unfortunately the latest bazel docker image is 3.5.0 so it's still relevant to us, since we use the docker image in our CI. The next question is whether it is possible to force the version of java in the |
For users of the 3.5.0 docker version, the following bazelrc works for me:
I put this in a file named |
I have a PR open for
The major difference between this and the other approaches is that we don't depend on the |
Hi @shs96c class SomeTest {
@Nested
@DisplayName("")
class SomeFirstLevelNestedTest {
@Nested
@DisplayName("")
class SomeSecondLevelNestedTest {
@Nested
@DisplayName("")
class SomeThirdLevelNestedTest {
// and so on
// nesting of internal tests can be quite deep
@Test
void name() {
Assertions.assertTrue(true);
}
}
}
}
} |
Hi @asinbow class SomeTest {
@Nested
@DisplayName("")
class SomeFirstLevelNestedTest {
@Nested
@DisplayName("")
class SomeSecondLevelNestedTest {
@Nested
@DisplayName("")
class SomeThirdLevelNestedTest {
// and so on
// nesting of internal tests can be quite deep
@Test
void name() {
Assertions.assertTrue(true);
}
}
}
}
} |
Hi @comius, Do you have any updates on this? |
There is a JUnit5 runner that ships as part of https://github.com/bazel-contrib/rules_jvm |
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team ( |
Looking at some of the issues referencing this (like internal Google dependencies), it appears that this should eventually be added a native feature. Should this be unmarked as stale, then? |
I'd be more than happy if the junit5 runner from |
Description of the problem / feature request:
JUnit v5 (Jupiter) is a significant new version of JUnit, bringing many new features and changes.
Bazel should natively support JUnit v5 (Jupiter) tests. JUnit v5 annotations and assertions cannot be run in v4.
Feature requests: what underlying problem are you trying to solve with this feature?
"bazel test" should run for JUnit5 tests
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
What operating system are you running Bazel on?
Windows.
What's the output of
bazel info release
?0.19.1
Have you found anything relevant by searching the web?
https://github.com/JeffreyFalgout/bazel-junit5.git
It fails with all kind of errors.
Any other information, logs, or outputs that you want to share?
Will upload sample on request.
The text was updated successfully, but these errors were encountered: