0

I created 2 Test classes (1 with 30 testcases, the other one with 10 testcases) in Apache Camel with Spring and Maven. One of the Test class works fine, and runs if I build with Maven.

mvn test <- Works with one Test class

mvn package <- Works also with one Test class

But the other test class don't run. Both are in src/test/java Also both test classes are in target/test-classes/... One different is in target/test-classes/... the not working class have an second file with ...Test$1.class in the same folder. But I cannot open it.

And one second different have the classes: The not working class extends from CamelTestSupport and is a junit4. The working test-class is from junit5.

I think the maven-surefire-plugin don't find the junit4 test class. But how can I make maven-surefire-plugin finding junit4 test classes?

Burner
  • 981
  • 19
  • 41

1 Answers1

0

The JUnit 4 tests have to be executed with the Vintage engine of JUnit and the JUnit 5 tests with the Jupiter engine.

See this answer how to configure the POM to use both engines depending on the version of the surefire plugin.

burki
  • 6,741
  • 1
  • 15
  • 31
  • Ok, now i get the error Message Dez 17, 2020 12:33:46 PM org.junit.platform.launcher.core.DefaultLauncher handleThrowable WARNUNG: TestEngine with ID 'junit-vintage' failed to discover tests org.junit.platform.commons.JUnitException: Failed to parse version of junit:junit: 4.13.1 – Burner Dec 17 '20 at 11:36
  • Ok, I change the junit Version to 4.13 now it works. Thank you – Burner Dec 17 '20 at 11:45