diff --git a/README.md b/README.md
index 9ee44524..433b0fd7 100644
--- a/README.md
+++ b/README.md
@@ -15,6 +15,7 @@ The Jenkins Coverage Plug-in collects reports of code coverage or mutation cover
- [PIT](https://pitest.org/): Mutation Coverage
- [JUnit](https://ant.apache.org/manual/Tasks/junitreport.html): Test Results
- [NUnit](https://nunit.org/): Test Results
+- [XUnit](https://xunit.net/): Test Results
If your coverage tool is not yet supported by the coverage plugin, feel free to provide a pull request for the [Coverage Model](https://github.com/jenkinsci/coverage-model/pulls).
@@ -109,6 +110,7 @@ The Coverage Plug-in supports the following report formats:
- [PIT](https://pitest.org/): Mutation Coverage
- [JUnit](https://ant.apache.org/manual/Tasks/junitreport.html): Test Results
- [NUnit](https://nunit.org/): Test Results
+- [XUnit](https://xunit.net/): Test Results
Some of these report files are generated by other tools and may contain invalid or inconsistent information. By default, the plugin tries to fail fast if such a broken file is detected. You can disable this behavior by setting the property `ignoreParsingErrors` to `true`. In this case, the plugin will try to parse as much information as possible from the report file.
diff --git a/plugin/pom.xml b/plugin/pom.xml
index d1e3d9a2..bafca768 100644
--- a/plugin/pom.xml
+++ b/plugin/pom.xml
@@ -25,7 +25,7 @@
jenkinsci/coverage-plugin
- 0.39.0
+ 0.40.0
1.17.2
diff --git a/plugin/src/main/java/io/jenkins/plugins/coverage/metrics/steps/CoverageTool.java b/plugin/src/main/java/io/jenkins/plugins/coverage/metrics/steps/CoverageTool.java
index 94a4b1d2..207ae9aa 100644
--- a/plugin/src/main/java/io/jenkins/plugins/coverage/metrics/steps/CoverageTool.java
+++ b/plugin/src/main/java/io/jenkins/plugins/coverage/metrics/steps/CoverageTool.java
@@ -216,6 +216,8 @@ public enum Parser {
JUNIT(Messages._Parser_Junit(), "**/TEST-*.xml",
"symbol-solid/list-check plugin-font-awesome-api"),
NUNIT(Messages._Parser_Nunit(), "**/nunit.xml,**/TestResult.xml",
+ "symbol-solid/list-check plugin-font-awesome-api"),
+ XUNIT(Messages._Parser_Xunit(), "**/xunit.xml,**/TestResult.xml",
"symbol-solid/list-check plugin-font-awesome-api");
private final Localizable displayName;
diff --git a/plugin/src/main/resources/io/jenkins/plugins/coverage/metrics/steps/Messages.properties b/plugin/src/main/resources/io/jenkins/plugins/coverage/metrics/steps/Messages.properties
index 8737f7ac..775a451a 100644
--- a/plugin/src/main/resources/io/jenkins/plugins/coverage/metrics/steps/Messages.properties
+++ b/plugin/src/main/resources/io/jenkins/plugins/coverage/metrics/steps/Messages.properties
@@ -6,6 +6,7 @@ Parser.OpenCover=OpenCover Coverage Reports
Parser.PIT=PIT Mutation Testing Reports
Parser.Junit=JUnit Test Results
Parser.Nunit=NUnit Test Results
+Parser.Xunit=XUnit Test Results
Coverage.Not.Available=n/a
Coverage.Link.Name=Coverage Report
diff --git a/plugin/src/test/java/io/jenkins/plugins/coverage/metrics/steps/CoveragePluginITest.java b/plugin/src/test/java/io/jenkins/plugins/coverage/metrics/steps/CoveragePluginITest.java
index 40eb847b..e4484682 100644
--- a/plugin/src/test/java/io/jenkins/plugins/coverage/metrics/steps/CoveragePluginITest.java
+++ b/plugin/src/test/java/io/jenkins/plugins/coverage/metrics/steps/CoveragePluginITest.java
@@ -424,6 +424,21 @@ void shouldRecordOneNUnitResultInFreestyleJob() {
});
}
+ @Test
+ void shouldRecordOneXUnitResultInFreestyleJob() {
+ FreeStyleProject project = createFreestyleJob(Parser.XUNIT, "xunit.xml");
+
+ Run, ?> build = buildSuccessfully(project);
+
+ CoverageBuildAction coverageResult = build.getAction(CoverageBuildAction.class);
+ assertThat(coverageResult.getAllValues(Baseline.PROJECT))
+ .filteredOn(Value::getMetric, Metric.TESTS)
+ .first()
+ .isInstanceOfSatisfying(TestCount.class, m -> {
+ assertThat(m.getValue()).isEqualTo(3);
+ });
+ }
+
@Test
void shouldRecordOnePitResultInFreestyleJob() {
FreeStyleProject project = createFreestyleJob(Parser.PIT, "mutations.xml");
diff --git a/plugin/src/test/resources/io/jenkins/plugins/coverage/metrics/steps/xunit.xml b/plugin/src/test/resources/io/jenkins/plugins/coverage/metrics/steps/xunit.xml
new file mode 100644
index 00000000..d6cc526f
--- /dev/null
+++ b/plugin/src/test/resources/io/jenkins/plugins/coverage/metrics/steps/xunit.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Assert.Equal() Failure
+ ↓ (pos 4)
+ Expected: Test3
+ Actual: Test
+ ↑ (pos 4)
+ at test.Tests2.ShouldCreateItem2() in /home/jenkins/test2/Tests2.cs:line 36
+ at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
+ at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
+
+
+
+
+
+
\ No newline at end of file