Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ public abstract class AbstractSurefireMojo extends AbstractMojo implements Suref
* @since 2.2
*/
@Deprecated // todo make readonly to handle system property
@Parameter(property = "disableXmlReport", defaultValue = "false")
@Parameter(property = "disableXmlReport")
private Boolean disableXmlReport;

/**
Expand Down Expand Up @@ -2060,8 +2060,8 @@ private StartupReportConfiguration getStartupReportConfiguration(String configCh
SurefireStatelessReporter xmlReporter =
statelessTestsetReporter == null ? new SurefireStatelessReporter() : statelessTestsetReporter;

if (isDisableXmlReport() != null) {
xmlReporter.setDisable(isDisableXmlReport());
if (disableXmlReport != null) {
xmlReporter.setDisable(disableXmlReport);
}

SurefireConsoleOutputReporter outReporter =
Expand Down Expand Up @@ -2613,7 +2613,7 @@ private String getConfigChecksum() {
checksum.add(getParallel());
checksum.add(isParallelOptimized());
checksum.add(isTrimStackTrace());
checksum.add(isDisableXmlReport());
checksum.add(disableXmlReport);
checksum.add(isUseSystemClassLoader());
checksum.add(isUseManifestOnlyJar());
checksum.add(getEncoding());
Expand Down Expand Up @@ -3596,15 +3596,6 @@ public void setTrimStackTrace(boolean trimStackTrace) {
this.trimStackTrace = trimStackTrace;
}

public Boolean isDisableXmlReport() {
return disableXmlReport;
}

@SuppressWarnings("UnusedDeclaration")
public void setDisableXmlReport(Boolean disableXmlReport) {
this.disableXmlReport = disableXmlReport;
}

public boolean isEnableAssertions() {
return enableAssertions;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public abstract class StatelessReporter<R extends TestSetReportEntry, S, C exten
/**
* {@code false} by default
*/
// todo remove isDisableXmlReport() in AbstractSurefireMojo and use this param instead
private boolean disable;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,12 @@ public SurefireLauncher setTestToRun(String basicTest) {
}

public SurefireLauncher setForkJvm() {
mavenLauncher.setForkJvm(true);
setForkJvm(true);
return this;
}

public SurefireLauncher setForkJvm(boolean forkJvm) {
mavenLauncher.setForkJvm(forkJvm);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.surefire.its.jiras;

import java.io.File;

import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
import org.apache.maven.surefire.its.fixture.SurefireLauncher;
import org.junit.Test;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

/**
* Integration Tests for SUREFIRE-1737
*/
public class Surefire1737IT extends SurefireJUnit4IntegrationTestCase {
@Test
public void selectJUnit5UsingConfiguredProviderWithPlatformRunner() {
SurefireLauncher launcher = unpack("surefire-1737");
launcher.setForkJvm(false)
.forkNever()
.executeTest()
.verifyTextInLog("Running pkg.JUnit5Test")
.verifyTextInLog(
"Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider");

File baseDir = launcher.getUnpackedAt();
assertTrue(new File(baseDir, "target/surefire-reports/pkg.JUnit5Test.txt").exists());
// xml report should be not generated
File xmlReport = new File(baseDir, "target/surefire-reports/TEST-pkg.JUnit5Test.xml");
assertFalse("xml report: " + xmlReport + " should not be generated", xmlReport.exists());
}
}
60 changes: 60 additions & 0 deletions surefire-its/src/test/resources/surefire-1737/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->

<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>org.example</groupId>
<artifactId>surefire-1737</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>${java.specification.version}</maven.compiler.source>
<maven.compiler.target>${java.specification.version}</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.12.1</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
<statelessTestsetReporter>
<disable>true</disable>
</statelessTestsetReporter>
</configuration>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package pkg;

import org.junit.jupiter.api.Test;

class JUnit5Test {
@Test
public void test() {
}
}
Loading