Coder Social home page Coder Social logo

qqilihq / maven-test-parser-plugin Goto Github PK

View Code? Open in Web Editor NEW
3.0 4.0 1.0 100 KB

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

License: Apache License 2.0

Java 100.00%
maven maven-plugin junit junit-xml junit-report junit-reports

maven-test-parser-plugin's Introduction

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

maven-test-parser-plugin's People

Contributors

danielesser avatar dependabot[bot] avatar qqilihq avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

danielesser

maven-test-parser-plugin's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.