Clarify on the use of useJUnitPlatform()
See original GitHub issueThe changelog states that even with Gradle 4.6 applying the JUnit Platform plugin is still required despite it being deprecated by the JUnit team. However, my hunch is that this is only the case if no
test {
useJUnitPlatform()
}
is used. Could you please clarify (in the change log) whether the note even applies with useJUnitPlatform()
?
Issue Analytics
- State:
- Created 5 years ago
- Comments:38 (35 by maintainers)
Top Results From Across the Web
cannot find method useJUnitPlatform for test task in gradle
Here is how I fixed it. I had this test task in my build.gradle : tasks.withType(Test) { useJUnitPlatform() testLogging { exceptionFormat ...
Read more >Gradle Sonarqube Plugin Not pushing code coverage report ...
We do use test { useJUnitPlatform() }. We generate both xml and html reports using jacoco looking at the coverage results in the...
Read more >On the mysteries of kotlin.test - Level Up Coding
Configure Gradle to use JUnit5: tasks { test { useJUnitPlatform() } }. But why? Why do you need extra dependencies for JUnit5, ...
Read more >Testing in Java & JVM projects - Gradle User Manual
A test task of type Test that runs those unit tests. The JVM language plugins use the source set to configure the task...
Read more >Using Java feature previews with Gradle
Instead, we're going to explain how to configure your Gradle build to use feature previews and therefore report issues/bugs to the JDK team....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I believe the current master has this fixed. I’ll do another 3.1.0 release candidate as soon as I can so we have other people verify the fix.
~I tried, and found that the tests are not found if you do not include the gradle-plugin, even with
useJUnitPlatform()
.~ It would be nice if this could be corrected, as including both is likely to eventually cause issues as they update JUnit.UPDATE: I tried removing the plugin again, and this time, the tests were found. I have since updated my JUnit5 from 5.1.0 to 5.1.1, but I doubt that had any affect. I may have simply had some stale code during my initial test?
UPDATE 2: Found the reason for the discrepency: in the second instance, Intellij was using the ‘junit runner’ rather than the gradle runner. Junit doesn’t have trouble discovering the tests, but the standard gradle runner DOES.