Skip to content

Demonstrate issue with gradle runner and junit 5 at gradle > 6.3

Notifications You must be signed in to change notification settings

mikehalmamoj/gradle-runner-junit5-kotlin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Update

Turned out that we were excluding the wrong module. ChangingspringBootTest.exclude(mapOf("group" to "junit", "module" to "junit")) to springBootTest.exclude(mapOf("group" to "junit", "module" to "org.junit.vintage")) fixed the problem.

gradle-runner-junit5-kotlin

Since we tried to update our Gradle plugin to use Gradle 6.4 some tests that assert JUnit 5 is working have started failing.

The problem appears to be that when using the Gradle Runner to build and run a project in a test, it somehow picks junit-vintage as the test engine even though it's been excluded from the project. It can't find junit-vintage, so it falls over.

This project is a minimal implementation to demonstrate the problem.

To reproduce:

  • Check out the project and run ./gradlew test

To workaround the problem:

  • Switch to Gradle 6.3 with command ./gradlew wrapper --gradle-version 6.3
  • Run command ./gradlew test
  • (No idea why this works)

An alternative workaround:

  • Switch back to Gradle 6.4!
  • In function MyPlugin#addDependencies, comment out line springBootTest.exclude(mapOf("group" to "junit", "module" to "junit"))
  • Run command ./gradlew test
  • (The test now works because with junit 4 back on the classpath the wrongly chosen engine is now available)

About

Demonstrate issue with gradle runner and junit 5 at gradle > 6.3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages