This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
The following commit(s) were added to refs/heads/master by this push:
new b71ad2bfb Show test status as text instead of images
b71ad2bfb is described below
commit b71ad2bfbfc4ba6351b7ac68d61ff053103a4664
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Sun Nov 1 12:45:40 2026 +0000
Show test status as text instead of images
Fixes #3564.
---
.../surefire/report/SurefireReportRenderer.java | 10 ++++++----
.../src/main/resources/surefire-report.properties | 4 ++++
.../plugins/surefire/report/Surefire597Test.java | 4 ++--
.../plugins/surefire/report/SurefireReportTest.java | 19 ++++++++-----------
4 files changed, 20 insertions(+), 17 deletions(-)
diff --git
a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportRenderer.java
b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportRenderer.java
index 896b50afd..6e741214b 100644
---
a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportRenderer.java
+++
b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportRenderer.java
@@ -594,12 +594,14 @@ private String toHtmlIdFailure(ReportTestCase testCase) {
}
private void sinkIcon(String type) {
- if (type.startsWith("junit.framework") || "skipped".equals(type)) {
- sink.figureGraphics("images/icon_warning_sml.gif");
+ if (type.startsWith("junit.framework")) {
+ sink.text(getI18nString("surefire", "label.status.failure"));
+ } else if ("skipped".equals(type)) {
+ sink.text(getI18nString("surefire", "label.status.skipped"));
} else if (type.startsWith("success")) {
- sink.figureGraphics("images/icon_success_sml.gif");
+ sink.text(getI18nString("surefire", "label.status.success"));
} else {
- sink.figureGraphics("images/icon_error_sml.gif");
+ sink.text(getI18nString("surefire", "label.status.error"));
}
}
diff --git
a/maven-surefire-report-plugin/src/main/resources/surefire-report.properties
b/maven-surefire-report-plugin/src/main/resources/surefire-report.properties
index ba45d6306..ab6c906b4 100644
--- a/maven-surefire-report-plugin/src/main/resources/surefire-report.properties
+++ b/maven-surefire-report-plugin/src/main/resources/surefire-report.properties
@@ -33,6 +33,10 @@ report.surefire.label.package=Package
report.surefire.label.class=Class
report.surefire.label.testcases=Test Cases
report.surefire.label.failuredetails=Failure Details
+report.surefire.label.status.success=success
+report.surefire.label.status.error=error
+report.surefire.label.status.failure=failure
+report.surefire.label.status.skipped=skipped
report.surefire.text.note1=Note: failures are anticipated and checked for with
assertions while errors are unanticipated.
report.surefire.text.note2=Note: package statistics are not computed
recursively, they only sum up all of its testsuites numbers.
report.surefire.value.successrate={0,choice,0#0%|0.0<{0,number,0.0%}|1#{0,number,0%}}
diff --git
a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire597Test.java
b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire597Test.java
index b350cebd2..95c58ff15 100644
---
a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire597Test.java
+++
b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire597Test.java
@@ -103,7 +103,7 @@ void
testCorruptedTestCaseFailureWithMissingErrorTypeAndMessage() throws Excepti
+ "<th>Success Rate</th>\n"
+ "<th>Time</th></tr>\n"
+ "<tr class=\"b\">\n"
- + "<td><a href=\"#surefire.MyTest\"><img
src=\"images/icon_error_sml.gif\" /></a></td>\n"
+ + "<td><a href=\"#surefire.MyTest\">error</a></td>\n"
+ "<td><a href=\"#surefire.MyTest\">MyTest</a></td>\n"
+ "<td>1</td>\n"
+ "<td>1</td>\n"
@@ -115,7 +115,7 @@ void
testCorruptedTestCaseFailureWithMissingErrorTypeAndMessage() throws Excepti
xml,
containsString(toSystemNewLine("<table class=\"bodyTable\">\n"
+ "<tr class=\"a\">\n"
- + "<td><img src=\"images/icon_error_sml.gif\"
/></td>\n"
+ + "<td>error</td>\n"
+ "<td><a
id=\"surefire.MyTest.test\"></a>test</td></tr>\n"
+ "<tr class=\"b\">\n"
+ "<td>-</td>\n"
diff --git
a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportTest.java
b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportTest.java
index 71e80986c..5d8ab096c 100644
---
a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportTest.java
+++
b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportTest.java
@@ -75,7 +75,7 @@ void testBasicSurefireReport(SurefireReport mojo) throws
Exception {
assertTrue(report.exists());
String htmlContent = String.join("\n",
Files.readAllLines(report.toPath()));
- int idx = htmlContent.indexOf("images/icon_success_sml.gif");
+ int idx = htmlContent.indexOf("<td>success</td>");
assertTrue(idx >= 0, "Wrong content in file: " + report);
assertThat(
@@ -86,10 +86,7 @@ void testBasicSurefireReport(SurefireReport mojo) throws
Exception {
htmlContent,
containsString("<a id=\"TC_com.shape.CircleTest.testRadius\" "
+
"href=\"./xref-test/com/shape/CircleTest.html\">testRadius</a>"));
- assertThat(
- htmlContent,
- containsString("<a href=\"#com.shape.CircleTest.testRadius\">"
- + "<img src=\"images/icon_warning_sml.gif\" /></a>"));
+ assertThat(htmlContent, containsString("<a
href=\"#com.shape.CircleTest.testRadius\">" + "failure</a>"));
assertThat(htmlContent,
containsString("toggleDisplay('com.shape.CircleTest.testRadius')"));
assertThat(htmlContent,
containsString("./xref-test/com/shape/CircleTest.html#L34"));
}
@@ -105,7 +102,7 @@ void
testBasicSurefireReportIfShowSuccessIsFalse(SurefireReport mojo) throws Exc
assertTrue(report.exists());
String htmlContent = String.join(System.lineSeparator(),
Files.readAllLines(report.toPath()));
- int idx = htmlContent.indexOf("images/icon_success_sml.gif");
+ int idx = htmlContent.indexOf("<td>success</td>");
assertTrue(idx < 0);
}
@@ -198,7 +195,7 @@ void testSurefireReportSingleError(SurefireReport mojo)
throws Exception {
containsString(toSystemNewLine("<tr class=\"b\">\n"
+ "<td>"
+ "<a href=\"#surefire.MyTest\">"
- + "<img src=\"images/icon_error_sml.gif\" />"
+ + "error"
+ "</a>"
+ "</td>\n"
+ "<td><a href=\"#surefire.MyTest\">MyTest</a></td>\n"
@@ -282,7 +279,7 @@ void
testSurefireReportNestedClassTrimStackTrace(SurefireReport mojo) throws Exc
containsString(toSystemNewLine("<tr class=\"b\">\n"
+ "<td>"
+ "<a href=\"#surefire.MyTest\">"
- + "<img src=\"images/icon_error_sml.gif\" />"
+ + "error"
+ "</a>"
+ "</td>\n"
+ "<td><a href=\"#surefire.MyTest\">MyTest</a></td>\n"
@@ -343,7 +340,7 @@ void testSurefireReportNestedClass(SurefireReport mojo)
throws Exception {
containsString(toSystemNewLine("<tr class=\"b\">\n"
+ "<td>"
+ "<a href=\"#surefire.MyTest\">"
- + "<img src=\"images/icon_error_sml.gif\" />"
+ + "error"
+ "</a>"
+ "</td>\n"
+ "<td><a href=\"#surefire.MyTest\">MyTest</a></td>\n"
@@ -429,7 +426,7 @@ void
testSurefireReportEnclosedTrimStackTrace(SurefireReport mojo) throws Except
containsString(toSystemNewLine("<tr class=\"b\">\n"
+ "<td>"
+ "<a href=\"#surefire.MyTest$A\">"
- + "<img src=\"images/icon_error_sml.gif\" />"
+ + "error"
+ "</a>"
+ "</td>\n"
+ "<td><a
href=\"#surefire.MyTest$A\">MyTest$A</a></td>\n"
@@ -490,7 +487,7 @@ void testSurefireReportEnclosed(SurefireReport mojo) throws
Exception {
containsString(toSystemNewLine("<tr class=\"b\">\n"
+ "<td>"
+ "<a href=\"#surefire.MyTest$A\">"
- + "<img src=\"images/icon_error_sml.gif\" />"
+ + "error"
+ "</a>"
+ "</td>\n"
+ "<td><a
href=\"#surefire.MyTest$A\">MyTest$A</a></td>\n"