Home > OS >  Enable junit extensions autodetection with gradle
Enable junit extensions autodetection with gradle

Time:12-22

I would like to enable by default junit extension autoDetection on my project if i understantd I should use -Djunit.jupiter.extensions.autodetection.enabled=true when i launch my build.

But i want to enable by default without extra parameters in the command line and in all my subModule.

I thing something like that should be good :

allprojects {
    test {
        //put an option here
        useJUnitPlatform()
    }

}

But i've no clue of which option to put in my build.gradle.

CodePudding user response:

In Gradle you can use the system properties extension:

test {
    // ...
    systemProperty("junit.jupiter.extensions.autodetection.enabled", true)
}

See JUnit 5 User Guide for further details.

  • Related