Fix Karate JUnit 5 Test Discovery Error

  • 25 Sep 2026

While trying to integrate Karate DSL into a project I was getting this error when executing the tests:

dependency issue

After looking around for a while I found that the problem was due to a crash with a few dependencies.

The Problem

The project was using the following test dependencies:

junit-jupiter-1 dependency

I had Karate configured as:

karate-dependency

Why It Happens

After doing some research, turns out karate-junit5 brings its own JUnit dependencies transitively.

When the project also declares newer JUnit versions (in this case JUnit Jupiter 5.12.2), Maven ends up with incompatible versions of JUnit Platform libraries on the classpath.

The result is a version mismatch that causes the JUnit engine to fail during test discovery, leading to a NoSuchMethodError.

The Solution

Exclude Karate's transitive JUnit dependencies and let the project use its own JUnit version.

junit-jupiter-fix

After excluding those dependencies the test suite executed normally.

This solution works also for dependency io.karatelabs - Karate JUnit 5.