Giorgi Tsiklauri
Giorgi Tsiklauri

Reputation: 11110

No tests were found - when using JUnit5 [in IntelliJ IDEA]

Project, with Java 11 and JUnit 5 stack, keeps outputting "No tests were found" in IntelliJ IDEA, if running tests (accordingly, not running any test if tried via maven's surefire plugin mvn test).

I've tried many variations, and finally figured out the solution. If the pom.xml has

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.2.1.RELEASE</version> //I suppose this is important entry in this problem
</parent>

then tests won't run and instead IntelliJ would always print "No tests were found"; however, this is immediately resolved if I simply remove <parent/> element from the pom.xml or change its version to 2.3.0.RELEASE

OK, the problem is solved like that, and it seems like some plugin or transitive dependency problem; however, any ideas what exactly mismatches with JUnit5 engine?

Upvotes: 4

Views: 5767

Answers (1)

Chels
Chels

Reputation: 191

In your JAVA test file, make sure you import org.junit.jupiter.api.Test; and not import org.junit.Test;.

Upvotes: 3

Related Questions