Split out from review discussion on #16281.
Problem
gradle/test-config.gradle adds testRuntimeOnly 'org.junit.platform:junit-platform-launcher' and calls useJUnitPlatform(), but never adds org.junit.jupiter:junit-jupiter-engine.
Without the engine on the test runtime classpath, JUnit 5 tests are not discovered — and the build does not fail. The test task reports BUILD SUCCESSFUL while executing zero tests.
This was found in grails-gsp/grails-taglib, whose only JUnit 5 test (GroovyPageAttributesTests) had never executed. Reverting just the one-line engine addition in that module reproduces it: :grails-taglib:test succeeds and discovers nothing.
Why it usually works
Every other module with JUnit 5 tests receives the engine only transitively, via runtimeOnly 'org.junit.jupiter:junit-jupiter-engine' in grails-testing-support-core. The six modules that declare junit-jupiter-api without an explicit engine all resolve it that way today. If that transitive edge is ever narrowed, the same silent-skip returns in those modules with a green build.
Suggested fix
Add the Jupiter engine to the gradle/test-config.gradle convention alongside the platform launcher, so no module can silently skip its JUnit 5 tests, and drop the now-redundant module-local declaration in grails-gsp/grails-taglib/build.gradle.
Worth considering alongside this: a guard that fails the build when a test task discovers zero tests in a module that has test sources, so this class of problem cannot be green again.
The module-local fix landed in #16281 to unblock that PR; this issue tracks the convention-level fix.
Split out from review discussion on #16281.
Problem
gradle/test-config.gradleaddstestRuntimeOnly 'org.junit.platform:junit-platform-launcher'and callsuseJUnitPlatform(), but never addsorg.junit.jupiter:junit-jupiter-engine.Without the engine on the test runtime classpath, JUnit 5 tests are not discovered — and the build does not fail. The test task reports
BUILD SUCCESSFULwhile executing zero tests.This was found in
grails-gsp/grails-taglib, whose only JUnit 5 test (GroovyPageAttributesTests) had never executed. Reverting just the one-line engine addition in that module reproduces it::grails-taglib:testsucceeds and discovers nothing.Why it usually works
Every other module with JUnit 5 tests receives the engine only transitively, via
runtimeOnly 'org.junit.jupiter:junit-jupiter-engine'ingrails-testing-support-core. The six modules that declarejunit-jupiter-apiwithout an explicit engine all resolve it that way today. If that transitive edge is ever narrowed, the same silent-skip returns in those modules with a green build.Suggested fix
Add the Jupiter engine to the
gradle/test-config.gradleconvention alongside the platform launcher, so no module can silently skip its JUnit 5 tests, and drop the now-redundant module-local declaration ingrails-gsp/grails-taglib/build.gradle.Worth considering alongside this: a guard that fails the build when a test task discovers zero tests in a module that has test sources, so this class of problem cannot be green again.
The module-local fix landed in #16281 to unblock that PR; this issue tracks the convention-level fix.