If I use JUnit5 to run legacy JUnit4 tests, is there any way to configure it to use ClassOrderer
for those JUnit4 classes? I saw in debugger that in org.junit.jupiter.engine.discovery.AbstractOrderingVisitor#orderChildrenTestDescriptors
only JUnit5 tests are returned and processed.
I run tests from gradle, using quite simple config
build.gradle:
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.8.1'
...
test {
useJUnitPlatform()
testLogging {
events "STARTED", "SKIPPED", "PASSED", "FAILED"
showStackTraces true
showCauses true
exceptionFormat "full"
}
}
junit-platform.properties:
junit.jupiter.testmethod.order.default=org.junit.jupiter.api.MethodOrderer$Random
junit.jupiter.testclass.order.default=org.junit.jupiter.api.ClassOrderer$Random