Test Parser Plugin for Maven

Allows parsing JUnit-style XML files generated by arbitrary 3rd party tools

License

License

Categories

Categories

Maven Build Tools
GroupId

GroupId

de.philippkatz.maven.plugins
ArtifactId

ArtifactId

test-parser-plugin
Last Version

Last Version

3.1.0
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

Test Parser Plugin for Maven
Allows parsing JUnit-style XML files generated by arbitrary 3rd party tools
Project URL

Project URL

https://github.com/qqilihq/maven-test-parser-plugin
Source Code Management

Source Code Management

http://github.com/qqilihq/maven-test-parser-plugin/tree/master

Download test-parser-plugin

How to add to project

<plugin>
    <groupId>de.philippkatz.maven.plugins</groupId>
    <artifactId>test-parser-plugin</artifactId>
    <version>3.1.0</version>
</plugin>

Dependencies

compile (2)

Group / Artifact Type Version
org.apache.maven : maven-plugin-api jar 3.3.9
org.apache.maven.surefire : surefire-report-parser jar 2.19

provided (1)

Group / Artifact Type Version
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.4

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

Test Parser Plugin for Maven

Actions Status codecov Maven Central

About

This Maven plugin solves the following issue which I described in this Stack Overflow question:

I'm running a Maven build workflow which involves running a 3rd party tool for integration testing, which produces multiple XML files in JUnit style (however, those files are not created by JUnit and I have no control over the testing procedure).

Is there a Maven plugin, which allows me to parse those files? Especially, I would like the build to fail, in case those XML files list a failure.

My exact problem has been described here some years ago, and the proposed solutions were:

  1. "Write your own plugin to call your external test and report failures, either by parsing the xml or some other approach" -- potential solution, however I hope that some years later maybe there is something ready-to-use?
  2. "Adjust your external test tool so it returns "false" (1) when it has a failure which Maven should pick up and understand to mean "failure encountered" and it will fail the build" -- unfortunately, I have no control over the external tool.

Usage

Through pom.xml

Add it to your pom.xml within the <build> section as follows and specify the resultsDirectory which contains the XML files with the test results. The plugin will also parse XML files within subdirectories.

  <build>
    <plugins>
      <plugin>
        <groupId>de.philippkatz.maven.plugins</groupId>
        <artifactId>test-parser-plugin</artifactId>
        <version>3.1.0</version>
        <configuration>
          <resultsDirectory>${project.build.directory}/testflow-reports</resultsDirectory>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>testparser</goal>
            </goals>
            <phase>integration-test</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

Via command line

In case you want to use it stand alone without a Maven project, you can still execute the plugin directly on the command line. Pass the path to the results directory with the -Dtestparser.resultsDirectory parameter:

$ mvn de.philippkatz.maven.plugins:test-parser-plugin:3.1.0:testparser -Dtestparser.resultsDirectory=./testflow-reports

Contributing

Pull requests are very welcome. Feel free to discuss bugs or new features by opening a new issue.


Copyright (c) 2017 – 2020, Philipp Katz

Versions

Version
3.1.0
2.0