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
Test suites not working with JUnit 5 #1334
Comments
What do you use for your test suites? |
We use: Does it make sense which of them to use? |
From the Javadoc: The
It cannot be used when running on the JUnit Platform. You should be able to use the |
Moreover, there's #744 to introduce native suites for the JUnit Platform. |
@marcphilipp can you elaborate? The current documentation says suites are supported via the syntax that @PE-test provides. https://junit.org/junit5/docs/current/user-guide/#running-tests-junit-platform-runner-test-suite Is the documentation incorrect? Is there a way to run the following command? If MySuiteOfTests is a test class, the tests run. If it is defined as a suite per the documentation, no tests are run.
Using Junit 5.2 / Junit platform runner/engine 1.2. Seems like #744 is not yet released so not a viable option at this point |
Also using maven-failsafe-plugin:2.22.0 |
Test suites that use #744 will provide a way to declare and run such suites directly using the JUnit Platform Launcher instead of going through the JUnit 4 infrastructure. For now, I'm afraid you'll have to resort to using a different way to organize and run your tests, e.g. a naming convention or a special package. |
The use of Note that you can use quite elaborate "tag expressions" to select your suite. |
Thanks @marcphilipp. The part about forcing surefire/failsafe to use the JUnit 4 provider was what I was missing. Do you think it would help to add this to the Junit5 documentation under the section about suites? That was not obvious at all how to set it up. I assume you take documentation PRs. |
I imagine that might be useful to some people as an interim solution.
Yes, of course we do! |
But nevertheless we can run both Junit4 and Junit5 tests via |
You can indeed do that, but only if you make sure that your build tool or IDE is executing the class annotated with Also, any class annotated with Also, any time you use In summary, |
When you create a test case, create it in JUNIT4 not in Jupiter. It works for the latest version 2019-06 |
I was moving tests from JUnit 4 to JUnit 5. We are using test suites in our project, and there I got some weird behavior. I'm able to launch tests with JUnit 5 RC versions, but on release 5.1 tests does not start.
Project and POM structure same as here.
Here is a working POM:
When I update to latest release versions:
Tests does not start, neither from Eclipse or Maven.
Could not find any mentions, that suites are not supported in latest release. So it seems like JUnit issue.
The text was updated successfully, but these errors were encountered: