This is an automated email from the ASF dual-hosted git repository. michaelo pushed a commit to branch SUREFIRE-2248 in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
commit 7b46e4a9dd3d4fcb18cd45947183e947742fe866 Author: Michael Osipov <micha...@apache.org> AuthorDate: Thu Jun 6 22:57:59 2024 +0200 [SUREFIRE-2248] Make "type" attribute on failures and errors in (surefire|failsafe)-test-report schema optional This closes #746 --- .../apache/maven/plugin/surefire/AbstractSurefireMojo.java | 2 +- .../surefire/extensions/SurefireStatelessReporter.java | 4 ++-- .../extensions/junit5/JUnit5Xml30StatelessReporter.java | 2 +- .../org/apache/maven/plugin/surefire/MojoMocklessTest.java | 2 +- .../plugin/surefire/extensions/StatelessReporterTest.java | 8 ++++---- .../plugin/surefire/report/StatelessXmlReporterTest.java | 8 ++++---- .../src/site/apt/examples/junit-platform.apt.vm | 6 +++--- .../src/site/resources/xsd/surefire-test-report.xsd | 14 +++++++------- .../test/resources/surefire-1894/TEST-surefire.MyTest.xml | 4 ++-- .../maven/surefire/extensions/StatelessReporter.java | 4 ++-- .../apache/maven/surefire/its/JUnitPlatformEnginesIT.java | 2 +- .../fixture/testsuitexmlparser/TEST-org.acme.FlakyTest.xml | 12 ++++++------ 12 files changed, 34 insertions(+), 34 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 7cd860960..f158c68d1 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 @@ -1936,7 +1936,7 @@ public abstract class AbstractSurefireMojo extends AbstractMojo implements Suref private StartupReportConfiguration getStartupReportConfiguration(String configChecksum, boolean isForking) { SurefireStatelessReporter xmlReporter = statelessTestsetReporter == null - ? new SurefireStatelessReporter(/*todo call def. constr.*/ isDisableXmlReport(), "3.0") + ? new SurefireStatelessReporter(/*todo call def. constr.*/ isDisableXmlReport(), "3.0.1") : statelessTestsetReporter; xmlReporter.setDisable(isDisableXmlReport()); // todo change to Boolean in the version 3.0.0-M6 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 7e73432fb..ebd7d0051 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 @@ -41,13 +41,13 @@ public class SurefireStatelessReporter * Activated in the injection point of MOJO. */ public SurefireStatelessReporter() { - this(false, "3.0"); + this(false, "3.0.1"); } /** * Activated if null injection point in MOJO. * @param disable {@code true} to disable performing the report - * @param version (xsd 3.0) version of the schema + * @param version version of the schema */ public SurefireStatelessReporter(boolean disable, String version) { setDisable(disable); 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 91182c565..689a4caed 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 @@ -26,7 +26,7 @@ import org.apache.maven.plugin.surefire.report.WrappedReportEntry; import org.apache.maven.surefire.extensions.StatelessReportEventListener; /** - * The extension of {@link StatelessReportEventListener xml reporter} based on XSD version 3.0 for JUnit5. + * The extension of {@link StatelessReportEventListener xml reporter} based on XSD version 3.0.1 for JUnit5. * Selectively enables phrased classes, methods and report files upon JUnit5 annotation <em>DisplayName</em>. * * author <a href="mailto:tibordig...@apache.org">Tibor Digana (tibor17)</a> diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java index d3717fc7d..5e1b0a87e 100644 --- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java +++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java @@ -67,7 +67,7 @@ public class MojoMocklessTest { @Test public void testGetStartupReportConfiguration2() throws Exception { AbstractSurefireMojo surefirePlugin = new Mojo(null, null); - SurefireStatelessReporter xmlReporter = new SurefireStatelessReporter(false, "3.0"); + SurefireStatelessReporter xmlReporter = new SurefireStatelessReporter(); SurefireConsoleOutputReporter consoleReporter = new SurefireConsoleOutputReporter(); SurefireStatelessTestsetInfoReporter testsetInfoReporter = new SurefireStatelessTestsetInfoReporter(); setInternalState(surefirePlugin, "statelessTestsetReporter", xmlReporter); 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 71140a48e..e034e2f56 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 @@ -55,7 +55,7 @@ public class StatelessReporterTest { @Test public void shouldAssertToStringXmlReporter() { SurefireStatelessReporter extension = new SurefireStatelessReporter(); - assertThat(extension.toString()).isEqualTo("SurefireStatelessReporter{version=3.0, disable=false}"); + assertThat(extension.toString()).isEqualTo("SurefireStatelessReporter{version=3.0.1, disable=false}"); } @Test @@ -69,7 +69,7 @@ public class StatelessReporterTest { reportsDirectory, reportNameSuffix, true, 5, schema, testClassMethodRunHistory); SurefireStatelessReporter extension = new SurefireStatelessReporter(); - assertThat(extension.getVersion()).isEqualTo("3.0"); + assertThat(extension.getVersion()).isEqualTo("3.0.1"); extension.setVersion("V3"); assertThat(extension.getVersion()).isEqualTo("V3"); @@ -128,7 +128,7 @@ public class StatelessReporterTest { public void shouldAssertToStringJUnit5ConsoleReporter() { JUnit5Xml30StatelessReporter extension = new JUnit5Xml30StatelessReporter(); assertThat(extension.toString()) - .isEqualTo("JUnit5Xml30StatelessReporter{version=3.0, disable=false, " + .isEqualTo("JUnit5Xml30StatelessReporter{version=3.0.1, disable=false, " + "usePhrasedFileName=false, usePhrasedTestSuiteClassName=false, " + "usePhrasedTestCaseClassName=false, usePhrasedTestCaseMethodName=false}"); } @@ -144,7 +144,7 @@ public class StatelessReporterTest { reportsDirectory, reportNameSuffix, true, 5, schema, testClassMethodRunHistory); JUnit5Xml30StatelessReporter extension = new JUnit5Xml30StatelessReporter(); - assertThat(extension.getVersion()).isEqualTo("3.0"); + assertThat(extension.getVersion()).isEqualTo("3.0.1"); extension.setVersion("V3"); assertThat(extension.getVersion()).isEqualTo("V3"); 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 19393bded..ea2cfbc0b 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 @@ -105,7 +105,7 @@ public class StatelessXmlReporterTest extends TestCase { 0, new ConcurrentHashMap<String, Deque<WrappedReportEntry>>(), XSD, - "3.0", + "3.0.1", false, false, false, @@ -165,7 +165,7 @@ public class StatelessXmlReporterTest extends TestCase { 0, new ConcurrentHashMap<String, Deque<WrappedReportEntry>>(), XSD, - "3.0", + "3.0.1", false, false, false, @@ -267,7 +267,7 @@ public class StatelessXmlReporterTest extends TestCase { 1, new HashMap<String, Deque<WrappedReportEntry>>(), XSD, - "3.0", + "3.0.1", false, false, false, @@ -370,7 +370,7 @@ public class StatelessXmlReporterTest extends TestCase { rerunStats.testSucceeded(testTwoSecondError); StatelessXmlReporter reporter = new StatelessXmlReporter( - reportDir, null, false, 1, new HashMap<>(), XSD, "3.0", false, false, false, false); + reportDir, null, false, 1, new HashMap<>(), XSD, "3.0.1", false, false, false, false); WrappedReportEntry testSetReportEntry = new WrappedReportEntry( new SimpleReportEntry( diff --git a/maven-surefire-plugin/src/site/apt/examples/junit-platform.apt.vm b/maven-surefire-plugin/src/site/apt/examples/junit-platform.apt.vm index 7e75af80c..0ea31bc68 100644 --- a/maven-surefire-plugin/src/site/apt/examples/junit-platform.apt.vm +++ b/maven-surefire-plugin/src/site/apt/examples/junit-platform.apt.vm @@ -5,7 +5,7 @@ ------ 2018-05-14 ------ - + ~~ 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 @@ -24,7 +24,7 @@ ~~ under the License. ~~ NOTE: For help with the syntax of this file, see: - ~~ http://maven.apache.org/doxia/references/apt-format.html + ~~ http://maven.apache.org/doxia/references/apt-format.html Using JUnit 5 Platform @@ -632,7 +632,7 @@ else <configuration> <statelessTestsetReporter implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5Xml30StatelessReporter"> <disable>false</disable> - <version>3.0</version> + <version>3.0.1</version> <usePhrasedFileName>false</usePhrasedFileName> <usePhrasedTestSuiteClassName>true</usePhrasedTestSuiteClassName> <usePhrasedTestCaseClassName>true</usePhrasedTestCaseClassName> diff --git a/maven-surefire-plugin/src/site/resources/xsd/surefire-test-report.xsd b/maven-surefire-plugin/src/site/resources/xsd/surefire-test-report.xsd index e19d6371c..2c901dc6f 100644 --- a/maven-surefire-plugin/src/site/resources/xsd/surefire-test-report.xsd +++ b/maven-surefire-plugin/src/site/resources/xsd/surefire-test-report.xsd @@ -17,7 +17,7 @@ ~ specific language governing permissions and limitations ~ under the License. --> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="3.0"> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="3.0.1"> <xs:element name="testsuite"> <xs:complexType> <xs:sequence> @@ -41,7 +41,7 @@ <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="message" type="xs:string"/> - <xs:attribute name="type" type="xs:string" use="required"/> + <xs:attribute name="type" type="xs:string"/> </xs:extension> </xs:simpleContent> </xs:complexType> @@ -54,7 +54,7 @@ <xs:element name="system-err" type="xs:string" minOccurs="0"/> </xs:sequence> <xs:attribute name="message" type="xs:string"/> - <xs:attribute name="type" type="xs:string" use="required"/> + <xs:attribute name="type" type="xs:string"/> </xs:complexType> </xs:element> <xs:element name="flakyFailure" minOccurs="0" maxOccurs="unbounded"> @@ -65,7 +65,7 @@ <xs:element name="system-err" type="xs:string" minOccurs="0"/> </xs:sequence> <xs:attribute name="message" type="xs:string"/> - <xs:attribute name="type" type="xs:string" use="required"/> + <xs:attribute name="type" type="xs:string"/> </xs:complexType> </xs:element> <xs:element name="skipped" nillable="true" minOccurs="0" maxOccurs="1"> @@ -82,7 +82,7 @@ <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="message" type="xs:string"/> - <xs:attribute name="type" type="xs:string" use="required"/> + <xs:attribute name="type" type="xs:string"/> </xs:extension> </xs:simpleContent> </xs:complexType> @@ -95,7 +95,7 @@ <xs:element name="system-err" type="xs:string" minOccurs="0"/> </xs:sequence> <xs:attribute name="message" type="xs:string"/> - <xs:attribute name="type" type="xs:string" use="required"/> + <xs:attribute name="type" type="xs:string"/> </xs:complexType> </xs:element> <xs:element name="flakyError" minOccurs="0" maxOccurs="unbounded"> @@ -106,7 +106,7 @@ <xs:element name="system-err" type="xs:string" minOccurs="0"/> </xs:sequence> <xs:attribute name="message" type="xs:string"/> - <xs:attribute name="type" type="xs:string" use="required"/> + <xs:attribute name="type" type="xs:string"/> </xs:complexType> </xs:element> <xs:element name="system-out" type="xs:string" minOccurs="0"/> diff --git a/maven-surefire-report-plugin/src/test/resources/surefire-1894/TEST-surefire.MyTest.xml b/maven-surefire-report-plugin/src/test/resources/surefire-1894/TEST-surefire.MyTest.xml index 4eb6d4557..690513df8 100644 --- a/maven-surefire-report-plugin/src/test/resources/surefire-1894/TEST-surefire.MyTest.xml +++ b/maven-surefire-report-plugin/src/test/resources/surefire-1894/TEST-surefire.MyTest.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<testsuite name="surefire.MyTest" version="3.0" time="0" tests="1" errors="1" skipped="0" failures="0"> +<testsuite name="surefire.MyTest" version="3.0.1" time="0" tests="1" errors="1" skipped="0" failures="0"> <properties> <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/> </properties> @@ -41,4 +41,4 @@ ... 26 more </error> </testcase> -</testsuite> \ No newline at end of file +</testsuite> diff --git a/surefire-extensions-api/src/main/java/org/apache/maven/surefire/extensions/StatelessReporter.java b/surefire-extensions-api/src/main/java/org/apache/maven/surefire/extensions/StatelessReporter.java index 5d91fca16..021d12231 100644 --- a/surefire-extensions-api/src/main/java/org/apache/maven/surefire/extensions/StatelessReporter.java +++ b/surefire-extensions-api/src/main/java/org/apache/maven/surefire/extensions/StatelessReporter.java @@ -40,7 +40,7 @@ public abstract class StatelessReporter<R extends TestSetReportEntry, S, C exten private boolean disable; /** - * Version of reporter. It is version <em>3.0</em> used by default in XML reporter. + * Version of reporter. It is version <em>3.0.1</em> used by default in XML reporter. */ private String version; @@ -62,7 +62,7 @@ public abstract class StatelessReporter<R extends TestSetReportEntry, S, C exten } public String getVersion() { - return isBlank(version) ? "3.0" : version; + return isBlank(version) ? "3.0.1" : version; } public void setVersion(String version) { diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformEnginesIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformEnginesIT.java index 06d075621..9ec2ab6da 100644 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformEnginesIT.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformEnginesIT.java @@ -51,7 +51,7 @@ public class JUnitPlatformEnginesIT extends SurefireJUnit4IntegrationTestCase { private static final String XML_TESTSUITE_FRAGMENT = "<testsuite xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=" + "\"https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd\" " - + "version=\"3.0\" name=\"<< ✨ >>\""; + + "version=\"3.0.1\" name=\"<< ✨ >>\""; @Parameter @SuppressWarnings("checkstyle:visibilitymodifier") diff --git a/surefire-report-parser/src/test/resources/fixture/testsuitexmlparser/TEST-org.acme.FlakyTest.xml b/surefire-report-parser/src/test/resources/fixture/testsuitexmlparser/TEST-org.acme.FlakyTest.xml index d333acfa3..e1d4ddad3 100644 --- a/surefire-report-parser/src/test/resources/fixture/testsuitexmlparser/TEST-org.acme.FlakyTest.xml +++ b/surefire-report-parser/src/test/resources/fixture/testsuitexmlparser/TEST-org.acme.FlakyTest.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<testsuite version="3.0" name="org.acme.FlakyTest" time="1.324" tests="1" errors="0" skipped="0" failures="0"> +<testsuite version="3.0.1" name="org.acme.FlakyTest" time="1.324" tests="1" errors="0" skipped="0" failures="0"> <properties> <property name="java.class.version" value="55.0"/> </properties> @@ -88,7 +88,7 @@ at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495) ]]></stackTrace> <system-out><![CDATA[2023-06-23 17:27:31,351 INFO [io.quarkus] (main) code-with-quarkus 1.0.0-SNAPSHOT on JVM (powered by Quarkus 3.1.2.Final) started in 1.493s. Listening on: http://localhost:8081 -2023-06-23 17:27:31,353 INFO [io.quarkus] (main) Profile test activated. +2023-06-23 17:27:31,353 INFO [io.quarkus] (main) Profile test activated. 2023-06-23 17:27:31,353 INFO [io.quarkus] (main) Installed features: [cdi, resteasy-reactive, smallrye-context-propagation, vertx] ]]></system-out> </flakyFailure> @@ -176,7 +176,7 @@ ]]></stackTrace> <system-out><![CDATA[2023-06-23 17:27:31,695 INFO [io.quarkus] (main) code-with-quarkus stopped in 0.022s 2023-06-23 17:27:33,059 INFO [io.quarkus] (main) code-with-quarkus 1.0.0-SNAPSHOT on JVM (powered by Quarkus 3.1.2.Final) started in 1.200s. Listening on: http://localhost:8081 -2023-06-23 17:27:33,059 INFO [io.quarkus] (main) Profile test activated. +2023-06-23 17:27:33,059 INFO [io.quarkus] (main) Profile test activated. 2023-06-23 17:27:33,059 INFO [io.quarkus] (main) Installed features: [cdi, resteasy-reactive, smallrye-context-propagation, vertx] ]]></system-out> </flakyFailure> @@ -264,7 +264,7 @@ ]]></stackTrace> <system-out><![CDATA[2023-06-23 17:27:33,117 INFO [io.quarkus] (main) code-with-quarkus stopped in 0.016s 2023-06-23 17:27:34,404 INFO [io.quarkus] (main) code-with-quarkus 1.0.0-SNAPSHOT on JVM (powered by Quarkus 3.1.2.Final) started in 1.180s. Listening on: http://localhost:8081 -2023-06-23 17:27:34,404 INFO [io.quarkus] (main) Profile test activated. +2023-06-23 17:27:34,404 INFO [io.quarkus] (main) Profile test activated. 2023-06-23 17:27:34,404 INFO [io.quarkus] (main) Installed features: [cdi, resteasy-reactive, smallrye-context-propagation, vertx] ]]></system-out> </flakyFailure> @@ -352,7 +352,7 @@ ]]></stackTrace> <system-out><![CDATA[2023-06-23 17:27:34,461 INFO [io.quarkus] (main) code-with-quarkus stopped in 0.014s 2023-06-23 17:27:35,705 INFO [io.quarkus] (main) code-with-quarkus 1.0.0-SNAPSHOT on JVM (powered by Quarkus 3.1.2.Final) started in 1.159s. Listening on: http://localhost:8081 -2023-06-23 17:27:35,705 INFO [io.quarkus] (main) Profile test activated. +2023-06-23 17:27:35,705 INFO [io.quarkus] (main) Profile test activated. 2023-06-23 17:27:35,705 INFO [io.quarkus] (main) Installed features: [cdi, resteasy-reactive, smallrye-context-propagation, vertx] ]]></system-out> <system-err><![CDATA[Test system.err @@ -360,4 +360,4 @@ </flakyError> </testcase> <testcase name="testStable" classname="org.acme.FlakyTest" time="0.001"/> -</testsuite> \ No newline at end of file +</testsuite>