From 93317ff07a4709bb1b0bd7690459fa81630fa3d4 Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Tue, 24 Sep 2024 08:23:57 +0200 Subject: [PATCH 01/16] [SUREFIRE-2269] Allow fail during clean in surefire-its --- surefire-its/pom.xml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/surefire-its/pom.xml b/surefire-its/pom.xml index 4e42b55488..13d8f36806 100644 --- a/surefire-its/pom.xml +++ b/surefire-its/pom.xml @@ -114,6 +114,7 @@ + maven-help-plugin @@ -241,5 +242,18 @@ + + github + + + env.GITHUB_ACTIONS + + + + + false + true + + From ab77c35c7fc788ae1aab5af525721afc881cc8ed Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 09:12:04 +0200 Subject: [PATCH 02/16] [SUREFIRE-2272] Bump org.codehaus.plexus:plexus-java from 1.2.0 to 1.3.0 - JDK 23 support Bumps [org.codehaus.plexus:plexus-java](https://github.com/codehaus-plexus/plexus-languages) from 1.2.0 to 1.3.0. - [Release notes](https://github.com/codehaus-plexus/plexus-languages/releases) - [Commits](https://github.com/codehaus-plexus/plexus-languages/compare/plexus-languages-1.2.0...plexus-languages-1.3.0) --- updated-dependencies: - dependency-name: org.codehaus.plexus:plexus-java dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index af719bb994..9382b1418f 100644 --- a/pom.xml +++ b/pom.xml @@ -93,7 +93,7 @@ 3.17.0 1.27.1 2.17.0 - 1.2.0 + 1.3.0 3.3.4 2.0.9 From ccc54d093afe361dfbce802461947148281a2ee2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Oct 2024 09:26:57 +0200 Subject: [PATCH 03/16] [SUREFIRE-2273] Bump org.hamcrest:hamcrest from 2.2 to 3.0 (#784) * Bump org.hamcrest:hamcrest from 2.2 to 3.0 Bumps [org.hamcrest:hamcrest](https://github.com/hamcrest/JavaHamcrest) from 2.2 to 3.0. - [Release notes](https://github.com/hamcrest/JavaHamcrest/releases) - [Changelog](https://github.com/hamcrest/JavaHamcrest/blob/master/CHANGES.md) - [Commits](https://github.com/hamcrest/JavaHamcrest/compare/v2.2...v3.0) --- updated-dependencies: - dependency-name: org.hamcrest:hamcrest dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * Manage hamcrest dependencies instead of exclusion and use where is needed --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Slawomir Jaranowski --- pom.xml | 26 ++++++--------------- surefire-its/pom.xml | 1 - surefire-providers/common-junit48/pom.xml | 5 ++++ surefire-providers/surefire-junit4/pom.xml | 5 ++++ surefire-providers/surefire-junit47/pom.xml | 5 ++++ 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/pom.xml b/pom.xml index 9382b1418f..62d50a31a0 100644 --- a/pom.xml +++ b/pom.xml @@ -205,12 +205,6 @@ org.mockito mockito-core 2.28.2 - - - org.hamcrest - hamcrest-core - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + 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 e6a1e5c203..a70bed30d6 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 @@ -18,115 +18,116 @@ ~ under the License. --> - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + - - + + + + + + + + + + + + + + + From 012183448e0af139455af71bcdc9ccae82365d38 Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Tue, 29 Oct 2024 14:20:07 +0100 Subject: [PATCH 13/16] [SUREFIRE-2283] FAQ site contains broken link to failsafe-plugin --- maven-surefire-plugin/src/site/fml/faq.fml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/maven-surefire-plugin/src/site/fml/faq.fml b/maven-surefire-plugin/src/site/fml/faq.fml index 2464d08cca..ae4e5af7e8 100644 --- a/maven-surefire-plugin/src/site/fml/faq.fml +++ b/maven-surefire-plugin/src/site/fml/faq.fml @@ -29,11 +29,11 @@ under the License. What is the difference between maven-failsafe-plugin and maven-surefire-plugin?

- maven-surefire-plugin + maven-surefire-plugin is designed for running unit tests and if any of the tests fail then it will fail the build immediately.

- maven-failsafe-plugin + maven-failsafe-plugin is designed for running integration tests, and decouples failing the build if there are test failures from actually running the tests.

From 88819715a698a2d85a2297443a1cb030a0a4f039 Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Tue, 29 Oct 2024 15:05:49 +0100 Subject: [PATCH 14/16] Remove outdated FAQ --- .../src/site/fml/faq.fml | 35 ------------------- .../src/site/site.xml | 1 - 2 files changed, 36 deletions(-) delete mode 100644 maven-surefire-report-plugin/src/site/fml/faq.fml diff --git a/maven-surefire-report-plugin/src/site/fml/faq.fml b/maven-surefire-report-plugin/src/site/fml/faq.fml deleted file mode 100644 index 68a52ecdda..0000000000 --- a/maven-surefire-report-plugin/src/site/fml/faq.fml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - The Surefire Report Plugin reruns tests. Is this its desired behavior? - -

- No. This is a well-known issue with older versions of the plugin. Please see - SUREFIRE-257 - for details. Upgrading to version 2.7.2 or newer will resolve this issue. -

-
-
-
-
diff --git a/maven-surefire-report-plugin/src/site/site.xml b/maven-surefire-report-plugin/src/site/site.xml index 017db2a69f..93ce07431c 100644 --- a/maven-surefire-report-plugin/src/site/site.xml +++ b/maven-surefire-report-plugin/src/site/site.xml @@ -26,7 +26,6 @@ - From 4385e9498b41df32b9016c60feb51396dcec5e1a Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Tue, 29 Oct 2024 15:06:13 +0100 Subject: [PATCH 15/16] Remove links to non-existing report --- maven-surefire-plugin/src/site/site.xml | 1 - maven-surefire-report-plugin/src/site/site.xml | 1 - 2 files changed, 2 deletions(-) diff --git a/maven-surefire-plugin/src/site/site.xml b/maven-surefire-plugin/src/site/site.xml index ea5e97146d..81139970d5 100644 --- a/maven-surefire-plugin/src/site/site.xml +++ b/maven-surefire-plugin/src/site/site.xml @@ -32,7 +32,6 @@ - diff --git a/maven-surefire-report-plugin/src/site/site.xml b/maven-surefire-report-plugin/src/site/site.xml index 93ce07431c..41fbd69502 100644 --- a/maven-surefire-report-plugin/src/site/site.xml +++ b/maven-surefire-report-plugin/src/site/site.xml @@ -26,7 +26,6 @@ - From d24adb4cd702253fa3bf1799e6f067c61d78d75f Mon Sep 17 00:00:00 2001 From: Bing Xu Date: Thu, 10 Oct 2024 09:40:53 +1100 Subject: [PATCH 16/16] [SUREFIRE-2277] RunResult#getFlakes() is lost during serialisation/deserialisation to/from failsafe-summary.xml This closes #790 --- .../util/FailsafeSummaryXmlUtils.java | 6 +++ .../maven/plugin/failsafe/RunResultTest.java | 48 +++++++++++++++++++ .../site/resources/xsd/failsafe-summary.xsd | 1 + .../maven/surefire/api/suite/RunResult.java | 4 ++ 4 files changed, 59 insertions(+) diff --git a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/util/FailsafeSummaryXmlUtils.java b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/util/FailsafeSummaryXmlUtils.java index ed39cc90ae..fac986b395 100644 --- a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/util/FailsafeSummaryXmlUtils.java +++ b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/util/FailsafeSummaryXmlUtils.java @@ -64,6 +64,7 @@ public final class FailsafeSummaryXmlUtils { + " %d\n" + " %d\n" + " %d\n" + + " %d\n" + " %s\n" + ""; @@ -84,12 +85,16 @@ public static RunResult toRunResult(File failsafeSummaryXml) throws Exception { String skipped = xpath.evaluate("/failsafe-summary/skipped", root); String failureMessage = xpath.evaluate("/failsafe-summary/failureMessage", root); String timeout = xpath.evaluate("/failsafe-summary/@timeout", root); + String flakes = xpath.evaluate("/failsafe-summary/flakes", root); return new RunResult( parseInt(completed), parseInt(errors), parseInt(failures), parseInt(skipped), + // FIXME Backwards compatability: to be replaced with parseInt in a future release + // synchronize with maven-surefire-plugin/src/site/resources/xsd/failsafe-summary.xsd + isBlank(flakes) ? 0 : parseInt(flakes), isBlank(failureMessage) ? null : unescapeXml(failureMessage), parseBoolean(timeout)); } @@ -107,6 +112,7 @@ public static void fromRunResultToFile(RunResult fromRunResult, File toFailsafeS fromRunResult.getErrors(), fromRunResult.getFailures(), fromRunResult.getSkipped(), + fromRunResult.getFlakes(), msg); Files.write( diff --git a/maven-failsafe-plugin/src/test/java/org/apache/maven/plugin/failsafe/RunResultTest.java b/maven-failsafe-plugin/src/test/java/org/apache/maven/plugin/failsafe/RunResultTest.java index 1bd4145bc1..80d3eeaa41 100644 --- a/maven-failsafe-plugin/src/test/java/org/apache/maven/plugin/failsafe/RunResultTest.java +++ b/maven-failsafe-plugin/src/test/java/org/apache/maven/plugin/failsafe/RunResultTest.java @@ -19,12 +19,17 @@ package org.apache.maven.plugin.failsafe; import java.io.File; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.StandardOpenOption; +import java.util.Locale; import org.apache.maven.plugin.failsafe.util.FailsafeSummaryXmlUtils; import org.apache.maven.surefire.api.suite.RunResult; import org.apache.maven.surefire.api.util.SureFireFileManager; import org.junit.Test; +import static java.lang.String.format; import static org.assertj.core.api.Assertions.assertThat; /** @@ -64,6 +69,49 @@ public void testSkipped() throws Exception { writeReadCheck(new RunResult(3, 2, 1, 0, null, true)); } + @Test + public void testFlakes() throws Exception { + writeReadCheck(new RunResult(3, 2, 1, 0, 2, null, true)); + } + + @Test + public void testLegacyDeserialization() throws Exception { + File legacySummary = SureFireFileManager.createTempFile("failsafe", "test"); + String legacyFailsafeSummaryXmlTemplate = "\n" + + "\n" + + " %d\n" + + " %d\n" + + " %d\n" + + " %d\n" + + " %s\n" + + ""; + String xml = format(Locale.ROOT, legacyFailsafeSummaryXmlTemplate, 0, false, 3, 2, 1, 0, "msg"); + Files.write( + legacySummary.toPath(), + xml.getBytes(StandardCharsets.UTF_8), + StandardOpenOption.CREATE, + StandardOpenOption.TRUNCATE_EXISTING, + StandardOpenOption.WRITE); + + // When the failsafe-summary.xml does not contain the element, it should be considered as 0. + RunResult expected = new RunResult(3, 2, 1, 0, 0, null, false); + RunResult actual = FailsafeSummaryXmlUtils.toRunResult(legacySummary); + + assertThat(actual.getCompletedCount()).isEqualTo(expected.getCompletedCount()); + + assertThat(actual.getErrors()).isEqualTo(expected.getErrors()); + + assertThat(actual.getFailures()).isEqualTo(expected.getFailures()); + + assertThat(actual.getSkipped()).isEqualTo(expected.getSkipped()); + + assertThat(actual.getFlakes()).isEqualTo(expected.getFlakes()); + + assertThat(actual).isEqualTo(expected); + } + @Test public void testAppendSerialization() throws Exception { RunResult simpleAggregate = getSimpleAggregate(); diff --git a/maven-surefire-plugin/src/site/resources/xsd/failsafe-summary.xsd b/maven-surefire-plugin/src/site/resources/xsd/failsafe-summary.xsd index c412ec59e9..b81565234b 100644 --- a/maven-surefire-plugin/src/site/resources/xsd/failsafe-summary.xsd +++ b/maven-surefire-plugin/src/site/resources/xsd/failsafe-summary.xsd @@ -25,6 +25,7 @@ + diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/api/suite/RunResult.java b/surefire-api/src/main/java/org/apache/maven/surefire/api/suite/RunResult.java index 8be1df1d04..545e7ab447 100644 --- a/surefire-api/src/main/java/org/apache/maven/surefire/api/suite/RunResult.java +++ b/surefire-api/src/main/java/org/apache/maven/surefire/api/suite/RunResult.java @@ -202,6 +202,9 @@ public boolean equals(Object o) { if (skipped != runResult.skipped) { return false; } + if (flakes != runResult.flakes) { + return false; + } if (timeout != runResult.timeout) { return false; } @@ -218,6 +221,7 @@ public int hashCode() { result = 31 * result + errors; result = 31 * result + failures; result = 31 * result + skipped; + result = 31 * result + flakes; result = 31 * result + (failure != null ? failure.hashCode() : 0); result = 31 * result + (timeout ? 1 : 0); return result;