revapi / revapi

Revapi is an API analysis and change tracking tool written in Java. Its focus is mainly on Java language itself but it has been specifically designed to not be limited to just Java. API is much more than just java classes - also various configuration files, schemas, etc. can contribute to it and users can become reliant on them.
http://revapi.org
Apache License 2.0
188 stars 47 forks source link

Generate JUnit compatible XML report #11

Open psiroky opened 9 years ago

psiroky commented 9 years ago

We use the revapi-maven-plugin and execute it as part of Maven build in Jenkins. When there are incompatibilities found, the whole build will fail (Jenkins marks that with red color).

It would great if the plugin (or directly revapi) could report the fails as failed test cases in the JUnit compatible format, so that Jenkins could pick that up and create nice report. Then Jenkins would mark the build as unstable (yellow) instead of failed (red). This would make it easy to see if the build failed because of some maven related error, or because some of the checks failed (e.g. revapi, animal-sniffer, etc).

Here is some info about how the JUnit XML format looks: http://stackoverflow.com/questions/4922867/junit-xml-format-specification-that-hudson-supports

metlos commented 9 years ago

Nice idea, this is definitely doable using a custom reporter for Revapi.

Basically this would be a new extension that would implement the https://github.com/revapi/revapi/blob/master/revapi/src/main/java/org/revapi/Reporter.java interface, packaged in a separate jar and put as a dependency of the revapi maven plugin.

You would be able to configure it inside the "analysisConfiguration" section of the revapi maven plugin's configuration.

metlos commented 9 years ago

In addition, for the maven plugin to do what you want, we would need to teach it to not fail on any kind of API problem (this cannot be done atm).

psiroky commented 9 years ago

Thanks for a quick response! I will try to look at this when I find some spare time...

metlos commented 9 years ago

Maven plugin 0.3.9 has just been released with the ability to not fail on errors. If you are planning to work or actually already are working on this, you can use that version.

metlos commented 8 years ago

Note that this should be easily implementable with revapi-reporting-text:0.5.0, once its released, using a custom FreeMarker template that would build the xml report for you. See commit 4eb43fb73e0be7e35f577853d22ba90f4e6a7ac1.

metlos commented 8 years ago

revapi-reporter-text:0.5.0 (notice the artifact ID which is different from what it used to be) has been released and I hope this is doable using a FreeMarker template. If not, we can always implement a new reporter with the full power of Java.

psiroky commented 8 years ago

Thanks for the info. My original idea was to use the surefire-common classes, similar as in here https://github.com/thradec/redhat-repository-validator/blob/master/src/main/java/com/redhat/repository/validator/impl/SurefireXmlReporter.java. But the FreeMarker sounds interesting as well.

However, I am not sure when I will be able to look at this...