From c05a159441a2b816c20705a4bb79e5bb8f12af47 Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Mon, 1 Jul 2024 23:04:10 +0200 Subject: [PATCH] [SUREFIRE-1360] Ability to disable properties for successfully passed tests This closes #755 --- .../plugin/surefire/AbstractSurefireMojo.java | 26 +++++++++++++++- .../plugin/surefire/CommonReflector.java | 2 ++ .../surefire/StartupReportConfiguration.java | 9 ++++++ ...faultStatelessReportMojoConfiguration.java | 4 ++- .../extensions/SurefireStatelessReporter.java | 3 +- .../junit5/JUnit5Xml30StatelessReporter.java | 3 +- .../report/NullStatelessXmlReporter.java | 2 +- .../surefire/report/StatelessXmlReporter.java | 30 +++++++++++++++++-- .../plugin/surefire/CommonReflectorTest.java | 1 + .../booterclient/ForkStarterTest.java | 2 ++ .../TestSetMockReporterFactory.java | 1 + .../extensions/StatelessReporterTest.java | 4 +-- .../report/DefaultReporterFactoryTest.java | 3 ++ .../report/StatelessXmlReporterTest.java | 7 +++-- .../api/booter/ProviderParameterNames.java | 2 ++ .../StatelessReportMojoConfiguration.java | 10 ++++++- .../junitcore/JUnitCoreParameters.java | 12 +++++++- .../junitcore/JUnitCoreParametersTest.java | 1 + .../surefire/junitcore/JUnitCoreTester.java | 1 + 19 files changed, 109 insertions(+), 14 deletions(-) diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java index 8552fcdcc8..bdd76ff64f 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java @@ -700,6 +700,14 @@ public abstract class AbstractSurefireMojo extends AbstractMojo implements Suref @Parameter(property = "enableOutErrElements", defaultValue = "true") private boolean enableOutErrElements; + /** + * Flag for including/excluding {@code } element for successfully passed tests in XML reports. + * + * @since 3.3.1 + */ + @Parameter(property = "enablePropertiesElement", defaultValue = "true") + private boolean enablePropertiesElement; + /** * The current build session instance. */ @@ -1488,6 +1496,10 @@ private void convertJunitCoreParameters() throws MojoExecutionException { .setProperty( ProviderParameterNames.ENABLE_OUT_ERR_ELEMENTS_PROP, Boolean.toString(isEnableOutErrElements())); + getProperties() + .setProperty( + ProviderParameterNames.ENABLE_PROPERTIES_ELEMENT_PROP, + Boolean.toString(isEnablePropertiesElement())); String message = "parallel='" + usedParallel + '\'' + ", perCoreThreadCount=" + getPerCoreThreadCount() @@ -1497,7 +1509,8 @@ private void convertJunitCoreParameters() throws MojoExecutionException { + ", threadCountClasses=" + getThreadCountClasses() + ", threadCountMethods=" + getThreadCountMethods() + ", parallelOptimized=" + isParallelOptimized() - + ", enableOutErrElements=" + isEnableOutErrElements(); + + ", enableOutErrElements=" + isEnableOutErrElements() + + ", enablePropertiesElement=" + isEnablePropertiesElement(); logDebugOrCliShowErrors(message); } @@ -1992,6 +2005,7 @@ private StartupReportConfiguration getStartupReportConfiguration(String configCh getEncoding(), isForking, isEnableOutErrElements(), + isEnablePropertiesElement(), xmlReporter, outReporter, testsetReporter); @@ -2533,6 +2547,7 @@ private String getConfigChecksum() { checksum.add(useModulePath()); checksum.add(getEnableProcessChecker()); checksum.add(isEnableOutErrElements()); + checksum.add(isEnablePropertiesElement()); addPluginSpecificChecksumItems(checksum); return checksum.getSha1(); } @@ -3498,6 +3513,15 @@ public void setEnableOutErrElements(boolean enableOutErrElements) { this.enableOutErrElements = enableOutErrElements; } + public boolean isEnablePropertiesElement() { + return enablePropertiesElement; + } + + @SuppressWarnings("UnusedDeclaration") + public void setEnablePropertiesElement(boolean enablePropertiesElement) { + this.enablePropertiesElement = enablePropertiesElement; + } + public MavenSession getSession() { return session; } diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java index 4aaa34c631..e902722b42 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java @@ -87,6 +87,7 @@ private Object createStartupReportConfiguration(@Nonnull StartupReportConfigurat String.class, boolean.class, boolean.class, + boolean.class, statelessTestsetReporter, consoleOutputReporter, statelessTestsetInfoReporter); @@ -105,6 +106,7 @@ private Object createStartupReportConfiguration(@Nonnull StartupReportConfigurat reporterConfiguration.getEncoding().name(), reporterConfiguration.isForking(), reporterConfiguration.isEnableOutErrElements(), + reporterConfiguration.isEnablePropertiesElement(), reporterConfiguration.getXmlReporter().clone(surefireClassLoader), reporterConfiguration.getConsoleOutputReporter().clone(surefireClassLoader), reporterConfiguration.getTestsetReporter().clone(surefireClassLoader) diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java index b4994869ed..43486c0ca6 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java @@ -87,6 +87,8 @@ public final class StartupReportConfiguration { private final boolean enableOutErrElements; + private final boolean enablePropertiesElement; + private final SurefireStatelessReporter xmlReporter; private final SurefireConsoleOutputReporter consoleOutputReporter; @@ -111,6 +113,7 @@ public StartupReportConfiguration( String encoding, boolean isForking, boolean enableOutErrElements, + boolean enablePropertiesElement, SurefireStatelessReporter xmlReporter, SurefireConsoleOutputReporter consoleOutputReporter, SurefireStatelessTestsetInfoReporter testsetReporter) { @@ -131,6 +134,7 @@ public StartupReportConfiguration( this.encoding = charset == null ? UTF_8 : Charset.forName(charset); this.isForking = isForking; this.enableOutErrElements = enableOutErrElements; + this.enablePropertiesElement = enablePropertiesElement; this.xmlReporter = xmlReporter; this.consoleOutputReporter = consoleOutputReporter; this.testsetReporter = testsetReporter; @@ -182,6 +186,7 @@ public StatelessReportEventListener instantiat rerunFailingTestsCount, xsdSchemaLocation, enableOutErrElements, + enablePropertiesElement, testClassMethodRunHistory); return xmlReporter.isDisable() ? null : xmlReporter.createListener(xmlReporterConfig); @@ -248,6 +253,10 @@ public boolean isEnableOutErrElements() { return enableOutErrElements; } + public boolean isEnablePropertiesElement() { + return enablePropertiesElement; + } + private File resolveReportsDirectory(Integer forkNumber) { return forkNumber == null ? reportsDirectory : replaceForkThreadsInPath(reportsDirectory, forkNumber); } diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/DefaultStatelessReportMojoConfiguration.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/DefaultStatelessReportMojoConfiguration.java index 57cae2ad9d..44479a13d6 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/DefaultStatelessReportMojoConfiguration.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/DefaultStatelessReportMojoConfiguration.java @@ -44,6 +44,7 @@ public DefaultStatelessReportMojoConfiguration( int rerunFailingTestsCount, String xsdSchemaLocation, boolean enableOutErrElements, + boolean enablePropertiesElement, Map> testClassMethodRunHistory) { super( reportsDirectory, @@ -51,7 +52,8 @@ public DefaultStatelessReportMojoConfiguration( trimStackTrace, rerunFailingTestsCount, xsdSchemaLocation, - enableOutErrElements); + enableOutErrElements, + enablePropertiesElement); this.testClassMethodRunHistory = testClassMethodRunHistory; } diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/SurefireStatelessReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/SurefireStatelessReporter.java index 5083418bc5..55bb25790d 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/SurefireStatelessReporter.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/SurefireStatelessReporter.java @@ -69,7 +69,8 @@ public StatelessReportEventListener createList false, false, false, - configuration.isEnableOutErrElements()); + configuration.isEnableOutErrElements(), + configuration.isEnablePropertiesElement()); } @Override diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/junit5/JUnit5Xml30StatelessReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/junit5/JUnit5Xml30StatelessReporter.java index a72f223864..9207d545ee 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/junit5/JUnit5Xml30StatelessReporter.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/junit5/JUnit5Xml30StatelessReporter.java @@ -108,7 +108,8 @@ public StatelessReportEventListener createList getUsePhrasedTestSuiteClassName(), getUsePhrasedTestCaseClassName(), getUsePhrasedTestCaseMethodName(), - configuration.isEnableOutErrElements()); + configuration.isEnableOutErrElements(), + configuration.isEnablePropertiesElement()); } @Override diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullStatelessXmlReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullStatelessXmlReporter.java index dc24f66a32..d4738df40d 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullStatelessXmlReporter.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullStatelessXmlReporter.java @@ -29,7 +29,7 @@ class NullStatelessXmlReporter extends StatelessXmlReporter { static final NullStatelessXmlReporter INSTANCE = new NullStatelessXmlReporter(); private NullStatelessXmlReporter() { - super(null, null, false, 0, null, null, null, false, false, false, false, true); + super(null, null, false, 0, null, null, null, false, false, false, false, true, true); } @Override diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java index f8c14bdaa4..7724b12109 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java @@ -118,6 +118,8 @@ public class StatelessXmlReporter implements StatelessReportEventListener> statistics : classMethodStatistics.values()) { + for (List thisMethodRuns : statistics.values()) { + if (thisMethodRuns.stream() + .anyMatch(entry -> entry.getReportEntryType() != ReportEntryType.SUCCESS)) { + hasNonSuccess = true; + break; + } + } + if (hasNonSuccess) { + break; + } + } + + if (hasNonSuccess) { + showProperties(ppw, testSetReportEntry.getSystemProperties()); + } + } for (Entry>> statistics : classMethodStatistics.entrySet()) { for (Entry> thisMethodRuns : diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/CommonReflectorTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/CommonReflectorTest.java index 45d9b27dd3..6fd82d6cb3 100644 --- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/CommonReflectorTest.java +++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/CommonReflectorTest.java @@ -83,6 +83,7 @@ public void setup() { null, false, true, + true, xmlReporter, consoleOutputReporter, infoReporter); diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkStarterTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkStarterTest.java index b10e919b78..b16765038a 100644 --- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkStarterTest.java +++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkStarterTest.java @@ -163,6 +163,7 @@ public void processShouldExitWithoutSayingGoodBye() throws Exception { null, true, true, + true, xmlReporter, outputReporter, statelessTestsetInfoReporter); @@ -249,6 +250,7 @@ public void processShouldWaitForAck() throws Exception { null, true, true, + true, xmlReporter, outputReporter, statelessTestsetInfoReporter); diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/TestSetMockReporterFactory.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/TestSetMockReporterFactory.java index c8dc5b236c..8a419acec6 100644 --- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/TestSetMockReporterFactory.java +++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/TestSetMockReporterFactory.java @@ -67,6 +67,7 @@ private static StartupReportConfiguration defaultValue() { null, true, true, + true, new SurefireStatelessReporter(), new SurefireConsoleOutputReporter(), new SurefireStatelessTestsetInfoReporter()); diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/StatelessReporterTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/StatelessReporterTest.java index 8ee90ee2cd..377cf68f1f 100644 --- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/StatelessReporterTest.java +++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/StatelessReporterTest.java @@ -66,7 +66,7 @@ public void shouldCreateConsoleListener() { String schema = "https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd"; Map> testClassMethodRunHistory = new HashMap<>(); DefaultStatelessReportMojoConfiguration config = new DefaultStatelessReportMojoConfiguration( - reportsDirectory, reportNameSuffix, true, 5, schema, true, testClassMethodRunHistory); + reportsDirectory, reportNameSuffix, true, 5, schema, true, true, testClassMethodRunHistory); SurefireStatelessReporter extension = new SurefireStatelessReporter(); assertThat(extension.getVersion()).isEqualTo("3.0.1"); @@ -141,7 +141,7 @@ public void shouldCreateJUnit5ConsoleListener() { String schema = "https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd"; Map> testClassMethodRunHistory = new HashMap<>(); DefaultStatelessReportMojoConfiguration config = new DefaultStatelessReportMojoConfiguration( - reportsDirectory, reportNameSuffix, true, 5, schema, true, testClassMethodRunHistory); + reportsDirectory, reportNameSuffix, true, 5, schema, true, true, testClassMethodRunHistory); JUnit5Xml30StatelessReporter extension = new JUnit5Xml30StatelessReporter(); assertThat(extension.getVersion()).isEqualTo("3.0.1"); diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java index 081248f47c..484d717984 100644 --- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java +++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java @@ -86,6 +86,7 @@ public void testMergeTestHistoryResult() throws Exception { null, false, true, + true, new SurefireStatelessReporter(), new SurefireConsoleOutputReporter(), new SurefireStatelessTestsetInfoReporter()); @@ -290,6 +291,7 @@ public void testLogger() { null, false, true, + true, new SurefireStatelessReporter(), new SurefireConsoleOutputReporter(), new SurefireStatelessTestsetInfoReporter()); @@ -355,6 +357,7 @@ public void testCreateReporterWithZeroStatistics() { null, false, true, + true, new SurefireStatelessReporter(), new SurefireConsoleOutputReporter(), new SurefireStatelessTestsetInfoReporter()); diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporterTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporterTest.java index 70e87e0e16..aa41e4b77d 100644 --- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporterTest.java +++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporterTest.java @@ -110,6 +110,7 @@ public void testFileNameWithoutSuffix() { false, false, false, + true, true); reporter.cleanTestHistoryMap(); @@ -171,6 +172,7 @@ public void testAllFieldsSerialized() throws IOException { false, false, false, + true, true); reporter.testSetCompleted(testSetReportEntry, stats); @@ -274,6 +276,7 @@ public void testOutputRerunFlakyFailure() throws IOException { false, false, false, + true, true); reporter.testSetCompleted(testSetReportEntry, stats); @@ -373,7 +376,7 @@ public void testOutputRerunFlakyAssumption() throws IOException { rerunStats.testSucceeded(testTwoSecondError); StatelessXmlReporter reporter = new StatelessXmlReporter( - reportDir, null, false, 1, new HashMap<>(), XSD, "3.0.1", false, false, false, false, true); + reportDir, null, false, 1, new HashMap<>(), XSD, "3.0.1", false, false, false, false, true, true); WrappedReportEntry testSetReportEntry = new WrappedReportEntry( new SimpleReportEntry( @@ -537,7 +540,7 @@ public void testReporterHandlesATestWithoutMessageAndWithEmptyStackTrace() { null); StatelessXmlReporter reporter = new StatelessXmlReporter( - reportDir, null, false, 1, new HashMap<>(), XSD, "3.0.1", false, false, false, false, true); + reportDir, null, false, 1, new HashMap<>(), XSD, "3.0.1", false, false, false, false, true, true); reporter.testSetCompleted(testReport, stats); } diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/api/booter/ProviderParameterNames.java b/surefire-api/src/main/java/org/apache/maven/surefire/api/booter/ProviderParameterNames.java index 95da2d3bee..b657888d28 100644 --- a/surefire-api/src/main/java/org/apache/maven/surefire/api/booter/ProviderParameterNames.java +++ b/surefire-api/src/main/java/org/apache/maven/surefire/api/booter/ProviderParameterNames.java @@ -47,4 +47,6 @@ public class ProviderParameterNames { public static final String PARALLEL_OPTIMIZE_PROP = "paralleloptimization"; public static final String ENABLE_OUT_ERR_ELEMENTS_PROP = "enableouterrelements"; + + public static final String ENABLE_PROPERTIES_ELEMENT_PROP = "enablepropertieselement"; } diff --git a/surefire-extensions-api/src/main/java/org/apache/maven/surefire/extensions/StatelessReportMojoConfiguration.java b/surefire-extensions-api/src/main/java/org/apache/maven/surefire/extensions/StatelessReportMojoConfiguration.java index ec3716deb9..694e50b4d8 100644 --- a/surefire-extensions-api/src/main/java/org/apache/maven/surefire/extensions/StatelessReportMojoConfiguration.java +++ b/surefire-extensions-api/src/main/java/org/apache/maven/surefire/extensions/StatelessReportMojoConfiguration.java @@ -38,19 +38,23 @@ public class StatelessReportMojoConfiguration { private final boolean enableOutErrElements; + private final boolean enablePropertiesElement; + public StatelessReportMojoConfiguration( File reportsDirectory, String reportNameSuffix, boolean trimStackTrace, int rerunFailingTestsCount, String xsdSchemaLocation, - boolean enableOutErrElements) { + boolean enableOutErrElements, + boolean enablePropertiesElement) { this.reportsDirectory = reportsDirectory; this.reportNameSuffix = reportNameSuffix; this.trimStackTrace = trimStackTrace; this.rerunFailingTestsCount = rerunFailingTestsCount; this.xsdSchemaLocation = xsdSchemaLocation; this.enableOutErrElements = enableOutErrElements; + this.enablePropertiesElement = enablePropertiesElement; } public File getReportsDirectory() { @@ -76,4 +80,8 @@ public String getXsdSchemaLocation() { public boolean isEnableOutErrElements() { return enableOutErrElements; } + + public boolean isEnablePropertiesElement() { + return enablePropertiesElement; + } } diff --git a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreParameters.java b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreParameters.java index 3e9beca45d..51eea78d40 100644 --- a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreParameters.java +++ b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreParameters.java @@ -50,6 +50,8 @@ public final class JUnitCoreParameters { public static final String ENABLE_OUT_ERR_ELEMENTS_KEY = ProviderParameterNames.ENABLE_OUT_ERR_ELEMENTS_PROP; + public static final String ENABLE_PROPERTIES_ELEMENT_KEY = ProviderParameterNames.ENABLE_PROPERTIES_ELEMENT_PROP; + private final String parallel; private final boolean perCoreThreadCount; @@ -72,6 +74,8 @@ public final class JUnitCoreParameters { private final boolean enableOutErrElements; + private final boolean enablePropertiesElement; + public JUnitCoreParameters(Map properties) { parallel = property(properties, PARALLEL_KEY, "none").toLowerCase(); perCoreThreadCount = property(properties, PERCORETHREADCOUNT_KEY, true); @@ -84,6 +88,7 @@ public JUnitCoreParameters(Map properties) { parallelTestsTimeoutForcedInSeconds = Math.max(property(properties, PARALLEL_TIMEOUTFORCED_KEY, 0d), 0); parallelOptimization = property(properties, PARALLEL_OPTIMIZE_KEY, true); enableOutErrElements = property(properties, ENABLE_OUT_ERR_ELEMENTS_KEY, true); + enablePropertiesElement = property(properties, ENABLE_PROPERTIES_ELEMENT_KEY, true); } private static Collection lowerCase(String... elements) { @@ -173,6 +178,10 @@ public boolean isEnableOutErrElements() { return enableOutErrElements; } + public boolean isEnablePropertiesElement() { + return enablePropertiesElement; + } + @Override public String toString() { return "parallel='" + parallel + '\'' + ", perCoreThreadCount=" + perCoreThreadCount + ", threadCount=" @@ -180,7 +189,8 @@ public String toString() { + threadCountSuites + ", threadCountClasses=" + threadCountClasses + ", threadCountMethods=" + threadCountMethods + ", parallelOptimization=" + parallelOptimization - + ", enableOutErrElements=" + enableOutErrElements; + + ", enableOutErrElements=" + enableOutErrElements + + ", enablePropertiesElement=" + enablePropertiesElement; } private static boolean property(Map properties, String key, boolean fallback) { diff --git a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreParametersTest.java b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreParametersTest.java index c635ca0d50..93e1adf954 100644 --- a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreParametersTest.java +++ b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreParametersTest.java @@ -46,6 +46,7 @@ public void defaultParameters() { assertThat(newTestSetDefault().getParallelTestsTimeoutForcedInSeconds(), is(0d)); assertTrue(newTestSetDefault().isParallelOptimization()); assertTrue(newTestSetDefault().isEnableOutErrElements()); + assertTrue(newTestSetDefault().isEnablePropertiesElement()); } @Test diff --git a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreTester.java b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreTester.java index 279a5c4051..156cc5ea97 100644 --- a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreTester.java +++ b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreTester.java @@ -110,6 +110,7 @@ private static StartupReportConfiguration defaultStartupReportConfiguration() { null, false, true, + true, new SurefireStatelessReporter(), new SurefireConsoleOutputReporter(), new SurefireStatelessTestsetInfoReporter());