Skip to content
Latchkey

JUnit 5 Tests Not Picked Up in CI - Add the Jupiter/Vintage Engine

JUnit 5 runs on the JUnit Platform with pluggable engines: junit-jupiter-engine runs JUnit 5 tests, junit-vintage-engine runs old JUnit 4 tests. If the engine for the style you wrote is absent, those tests are silently not discovered.

What this error means

A migrated suite shows fewer tests than expected, or Tests run: 0 for JUnit 5 classes. JUnit 4 tests vanish after dropping JUnit 4, because no vintage engine remains to run them.

junit
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
# org.junit.jupiter.api.Test classes exist but no jupiter engine is on the classpath

Diagnose it: resolve the effective POM first

Maven merges parent POMs, profiles, and settings before it builds anything. The configuration causing your failure is frequently inherited or activated by a profile that is on locally and off in CI.

Terminal
# the fully resolved configuration Maven will actually use
mvn help:effective-pom | head -60

# which profiles are active here vs on your machine?
mvn help:active-profiles

# full error, offline-safe, no colour codes to confuse the log
mvn -B -e -X <goal> 2>&1 | tail -60

Common causes

jupiter-engine missing

You depend on junit-jupiter-api (compiles annotations) but not junit-jupiter-engine (runs them), so the platform has nothing to execute JUnit 5 tests with.

Old JUnit 4 tests with no vintage engine

After moving to the platform, JUnit 4 @Test classes need junit-vintage-engine to run. Without it they are quietly skipped.

How to fix it

Add the Jupiter aggregator (and vintage if needed)

Use junit-jupiter (which pulls api + engine + params) and add vintage only for legacy tests.

pom.xml
<dependency>
  <groupId>org.junit.jupiter</groupId>
  <artifactId>junit-jupiter</artifactId>
  <version>5.10.2</version>
  <scope>test</scope>
</dependency>
<!-- only if you still have JUnit 4 tests -->
<dependency>
  <groupId>org.junit.vintage</groupId>
  <artifactId>junit-vintage-engine</artifactId>
  <version>5.10.2</version>
  <scope>test</scope>
</dependency>

Enable the platform in Gradle

Gradle needs useJUnitPlatform() to run JUnit 5 at all.

build.gradle
test {
  useJUnitPlatform()
}
dependencies {
  testImplementation 'org.junit.jupiter:junit-jupiter:5.10.2'
  testRuntimeOnly    'org.junit.vintage:junit-vintage-engine:5.10.2'
}

How to prevent it

  • Depend on the junit-jupiter aggregator, call useJUnitPlatform() in Gradle, keep vintage only while JUnit 4 tests exist, and assert the expected test count in CI.

Frequently asked questions

What causes JUnit 5 tests not picked up in CI?
There are 2 common causes: jupiter-engine missing and old junit 4 tests with no vintage engine. You depend on junit-jupiter-api (compiles annotations) but not junit-jupiter-engine (runs them), so the platform has nothing to execute JUnit 5 tests with.
How do I fix JUnit 5 tests not picked up in CI?
There are 2 fixes depending on which cause you have: add the jupiter aggregator (and vintage if needed) and enable the platform in gradle. Work through them in order, since the first is the most common.
What does JUnit 5 tests not picked up in CI actually mean?
A migrated suite shows fewer tests than expected, or Tests run: 0 for JUnit 5 classes.
How do I stop JUnit 5 tests not picked up in CI happening again?
Depend on the junit-jupiter aggregator, call useJUnitPlatform() in Gradle, keep vintage only while JUnit 4 tests exist, and assert the expected test count in CI.

Related guides

References

Not every red build is your code. Latchkey repairs the ones that are not, on the runner. Start free → 30-day trial · No credit card