Reputation: 41
I am trying to run tests in a project with Apache Maven 3.8.3, JDK 14, JUnit 5.8.1, jqwik 1.5.6
I'm using IntelliJ IDEA 2021.2.3 (Community Edition)
The libraries must be correctly imported but it still doesn't work. When I try to run simple tests I 'm getting the following error message:
"Internal Error occurred. org.junit.platform.commons.JUnitException: TestEngine with ID 'junit-jupiter' failed to discover tests"
Here is the pom.xml file. I'd appreciate any advice and thanks in advance!
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>tests</groupId>
<artifactId>tests</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>${project.basedir}/src</sourceDirectory>
<testSourceDirectory>${project.basedir}/src/tests</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<includes>
<include>**/*Tests.java</include>
<include>**/*Examples.java</include>
<include>**/*Properties.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.1</version>
</dependency>
<dependency>
<groupId>net.jqwik</groupId>
<artifactId>jqwik</artifactId>
<version>1.5.6</version>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>14</maven.compiler.source>
<maven.compiler.target>14</maven.compiler.target>
</properties>
</project>
Upvotes: 4
Views: 11570
Reputation: 10823
I had similar and other issues, when IntelliJ IDEA won't run unit tests, but "mvn test -pl ..." successfully runs them.
All of such issues had magically gone away after I did the following:
Also I disabled the "Coverage" plugin - my reasoning is that IDEA won't re-compile classes to instrument them for collection of code coverage.
Upvotes: 1