FAGIM SADYKOV created SUREFIRE-1401:
---------------------------------------
Summary: If test FAILS with forks > 0 - OutOfMemory with Junit5,
another Error with forks=0
Key: SUREFIRE-1401
URL: https://issues.apache.org/jira/browse/SUREFIRE-1401
Project: Maven Surefire
Issue Type: Bug
Components: JUnit 5.x support, Maven Surefire Plugin, process forking
Affects Versions: 2.20
Environment: Maven 3.5.0, Java 1.8, Junit5 (M4, M5)
Reporter: FAGIM SADYKOV
Attachments: FailedTest.java, pom.xml
In attachment where is minimal project to cause problem.
Create project with given POM and single test, then run `mvn test` - it will be
fail not about Test fails, but about OutOfMemory exception.
If you change forks to Zero then it not fails with OutOfMemory, but about
`java.lang.ClassNotFoundException:
org.apache.maven.plugin.surefire.log.api.ConsoleLogger`
There is no difference on M4 or M5 of Junit5 subversion.
There is no problem if test not fails
The only solution is to change 2.20 back to 2.19.1 - it will be good on any
forking and M4 and M5
POM:
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>outer-issues</groupId>
<artifactId>surefire-plugin-bug-OutOfMemory</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<!-- change to 0 - it will be not OutOfMemory exception, but
it will be problem with Execution default-test of goal
org.apache.maven.plugins:maven-surefire-plugin:2.20:test failed:
java.lang.ClassNotFoundException:
org.apache.maven.plugin.surefire.log.api.ConsoleLogger -> [Help 1] -->
<forks>1</forks>
<!-- or change to 2.19.1 - all will be good -->
<surefire_version>2.20</surefire_version>
<!-- you can change it to 4 (M4) - but if surefire 2.20 - problem still
exists
- so it's not on Junit site -->
<junut5suffix>5</junut5suffix>
</properties>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jre8</artifactId>
<version>1.1.3-2</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.0.0-M${junut5suffix}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.0.0-M${junut5suffix}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire_version}</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.0.0-M${junut5suffix}</version>
</dependency>
</dependencies>
<configuration>
<forkCount>${forks}</forkCount>
</configuration>
</plugin>
</plugins>
</build>
</project>
{code}
Test:
{code}
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertNotNull;
public class FailedTest {
@Test
public void fail(){
// you can change it to assertNull - it will be not problem in
MAVEN
assertNotNull(null);
}
}
{code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)