Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intelij 2019.1 update breaks JUnit tests

After 2019.1 update broke all tests with error:

no tests found for given includes xxxx.someThingTest

like image 723
Mike Avatar asked Mar 28 '19 19:03

Mike


4 Answers

Intelij somehow changed setting with update.

Settings > Build,Execution,Deployment > Build Tools > Gradle > Runner > "Run tests using:"

Changed from "Gradle Test runner" to "Platform Test runner" and it worked. I hope this is useful in some matter.

like image 64
Mike Avatar answered Oct 19 '22 17:10

Mike


If you are using JUnit5 with Gradle, add below code to build.gradle file.

test {
    useJUnitPlatform()
}

I've got a hint from https://www.baeldung.com/junit-5-gradle

like image 24
Youngjae Avatar answered Oct 19 '22 19:10

Youngjae


Checkout this build.gradle file for using Junit5

https://github.com/junit-team/junit5-samples/blob/r5.4.0/junit5-jupiter-starter-gradle/build.gradle

like image 36
abitcode Avatar answered Oct 19 '22 17:10

abitcode


I experienced the same problem in 2019.2 for a newly developped class that was not detected. I strangely solved it by manually running "Build->Rebuild Project"

The workaround with Runner by Mike was not working for me.

like image 30
Guillaume Berche Avatar answered Oct 19 '22 17:10

Guillaume Berche