Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SUREFIRE-2248] Make "type" attribute on failures and errors in (sure… #746

Merged
merged 1 commit into from
Jun 8, 2024
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 @@ -1936,7 +1936,7 @@ private Artifact getShadefireArtifact() {

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
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:tibordigana@apache.org">Tibor Digana (tibor17)</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void testGetStartupReportConfiguration() throws Exception {
@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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void shouldCloneXmlReporter() {
@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
Expand All @@ -69,7 +69,7 @@ public void shouldCreateConsoleListener() {
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");

Expand Down Expand Up @@ -128,7 +128,7 @@ public void shouldCloneJUnit5XmlReporter() {
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}");
}
Expand All @@ -144,7 +144,7 @@ public void shouldCreateJUnit5ConsoleListener() {
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");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void testFileNameWithoutSuffix() {
0,
new ConcurrentHashMap<String, Deque<WrappedReportEntry>>(),
XSD,
"3.0",
"3.0.1",
false,
false,
false,
Expand Down Expand Up @@ -165,7 +165,7 @@ public void testAllFieldsSerialized() throws IOException {
0,
new ConcurrentHashMap<String, Deque<WrappedReportEntry>>(),
XSD,
"3.0",
"3.0.1",
false,
false,
false,
Expand Down Expand Up @@ -267,7 +267,7 @@ public void testOutputRerunFlakyFailure() throws IOException {
1,
new HashMap<String, Deque<WrappedReportEntry>>(),
XSD,
"3.0",
"3.0.1",
false,
false,
false,
Expand Down Expand Up @@ -370,7 +370,7 @@ public void testOutputRerunFlakyAssumption() throws IOException {
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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand All @@ -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">
Expand All @@ -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">
Expand All @@ -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>
Expand All @@ -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">
Expand All @@ -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"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -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>
Expand Down Expand Up @@ -41,4 +41,4 @@
... 26 more
</error>
</testcase>
</testsuite>
</testsuite>
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -62,7 +62,7 @@ public void setDisable(boolean disable) {
}

public String getVersion() {
return isBlank(version) ? "3.0" : version;
return isBlank(version) ? "3.0.1" : version;
}

public void setVersion(String version) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
@RunWith(Parameterized.class)
@SuppressWarnings("checkstyle:magicnumber")
public class JUnitPlatformEnginesIT extends SurefireJUnit4IntegrationTestCase {
// This must correspond to the Surefire version uses for testing
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\" "
Expand Down
Original file line number Diff line number Diff line change
@@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -352,12 +352,12 @@
]]></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
]]></system-err>
</flakyError>
</testcase>
<testcase name="testStable" classname="org.acme.FlakyTest" time="0.001"/>
</testsuite>
</testsuite>
Loading