Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

Allows parsing JUnit-style XML files generated by arbitrary 3rd party tools
https://github.com/qqilihq/maven-test-parser-plugin

junit junit-report junit-reports junit-xml maven maven-plugin

Last synced: 6 days ago
JSON representation

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

Awesome Lists containing this project

README

        

Test Parser Plugin for Maven
============================

[![Actions Status](https://github.com/qqilihq/maven-test-parser-plugin/workflows/CI/badge.svg)](https://github.com/qqilihq/maven-test-parser-plugin/actions)
[![codecov](https://codecov.io/gh/qqilihq/maven-test-parser-plugin/branch/master/graph/badge.svg)](https://codecov.io/gh/qqilihq/maven-test-parser-plugin)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/de.philippkatz.maven.plugins/test-parser-plugin/badge.svg)](http://mvnrepository.com/artifact/de.philippkatz.maven.plugins/test-parser-plugin)

About
-----

This [Maven][3] plugin solves the following issue which I described in [this][2] 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][1] 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 `` 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.

```xml



de.philippkatz.maven.plugins
test-parser-plugin
3.1.0

${project.build.directory}/testflow-reports




testparser

integration-test





```

### 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:

```shell
$ 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][2].

- - -

Copyright (c) 2017 – 2020, Philipp Katz

[1]: http://maven.40175.n5.nabble.com/How-to-parse-JUnit-report-xml-that-causes-build-to-pass-fail-td5433750.html
[2]: http://stackoverflow.com/questions/33857858/parse-junit-result-xml-format-created-by-3rd-party-tool-with-maven
[3]: https://maven.apache.org
[4]: https://github.com/qqilihq/maven-test-parser-plugin/issues