igr
igr

Reputation: 10604

JUnit5 integration tests with Gradle 4.6

Gradle 4.6 added support for JUnit5.

This works for me as long as I don't have another sourceset for e.g. integration tests: I do not know how to enable useJUnitPlatform() in my integration tests.

What I was able to do is to have test task working with new JUnit5 support, but my testInt task was using JUnit5 console and running tests as it would run from command line. At the end I ditch JUnit5 support in gradle and rollback to using JUnit5 console for both tests.

How to enable Gradle 4.6 JUnit5 support on other tasks then test?

Upvotes: 3

Views: 1788

Answers (1)

Sormuras
Sormuras

Reputation: 9059

If your integration test task is also a Test task, you may configure all test tasks via:

tasks.withType(Test) {
    useJUnitPlatform()
}

Or configure it explicitly:

task testInt(type: Test) {
    useJUnitPlatform()
    ...
}

Upvotes: 11

Related Questions