As gradle 4.6 supports JUnit 5 with following configuration.
test {
useJUnitPlatform()
}
It seems like the old way to change testinstance lifecycle doesn't work.
junitPlatform {
// ...
configurationParameter 'junit.jupiter.conditions.deactivate', '*'
configurationParameters([
'junit.jupiter.extensions.autodetection.enabled': 'true',
'junit.jupiter.testinstance.lifecycle.default': 'per_class'
])
// ...
}
https://junit.org/junit5/docs/current/user-guide/#running-tests-build-gradle-config-params
How to switch JUnit 5 test instance lifecycle to "per-class" in gradle 4.6+?