Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-10835

Add support for JaCoCo coverage results

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Component/s: emma-plugin
    • Labels:
      None

      Description

      JaCoCo is the successor of emma.
      Maybe it is possible to support the new coverage file format.

        Activity

        Hide
        centic centic added a comment -

        FYI, I started a discussion at https://sourceforge.net/projects/eclemma/forums/forum/614869/topic/4905055 for allowing JaCoCo to export in the existing Emma XML format, which would also allow to use the existing Emma Plugin in Jenkins for handling JaCoCo coverage data until a separate Plugin is officially available.

        Show
        centic centic added a comment - FYI, I started a discussion at https://sourceforge.net/projects/eclemma/forums/forum/614869/topic/4905055 for allowing JaCoCo to export in the existing Emma XML format, which would also allow to use the existing Emma Plugin in Jenkins for handling JaCoCo coverage data until a separate Plugin is officially available.
        Hide
        schlegel_m Markus Schlegel added a comment -

        Attached an xslt Stylesheet which converts the jacoco xml into emma-plugin compatible xml.
        Its not perfect, but at least, you can include jacoco into jenkins builds now without getting errors.
        Not all coverage metrics could be mapped 1:1.
        Also Method names are not perfect, but for me its sufficent.

        Show
        schlegel_m Markus Schlegel added a comment - Attached an xslt Stylesheet which converts the jacoco xml into emma-plugin compatible xml. Its not perfect, but at least, you can include jacoco into jenkins builds now without getting errors. Not all coverage metrics could be mapped 1:1. Also Method names are not perfect, but for me its sufficent.
        Hide
        schlegel_m Markus Schlegel added a comment - - edited

        Use the stylesheet in your ant-buildfile like:

         
        <jacoco:report>
          bla bla
          <xml destfile="${build.dest}/test-reports/coverage_jacoco.xml" />
        </jacoco:report>
        
        <xslt style="${build.installer.dir}/coverage/jacoco_to_emma.xslt" in="${build.dest}/test-reports/coverage_jacoco.xml" out="${build.dest}/test-reports/coverage.xml" >
          <!-- saxon or some other xslt2/xpath2 processor is required -->
          <classpath>
             <pathelement location="${top.dir}/lib/saxon9he.jar"/>
          </classpath>
        </xslt>
        

        Of corse, the "group" settings from jacoco will be lost, since emma does not support this.

        Show
        schlegel_m Markus Schlegel added a comment - - edited Use the stylesheet in your ant-buildfile like: <jacoco:report> bla bla <xml destfile= "${build.dest}/test-reports/coverage_jacoco.xml" /> </jacoco:report> <xslt style= "${build.installer.dir}/coverage/jacoco_to_emma.xslt" in= "${build.dest}/test-reports/coverage_jacoco.xml" out= "${build.dest}/test-reports/coverage.xml" > <!-- saxon or some other xslt2/xpath2 processor is required --> <classpath> <pathelement location= "${top.dir}/lib/saxon9he.jar" /> </classpath> </xslt> Of corse, the "group" settings from jacoco will be lost, since emma does not support this.
        Hide
        ka3was Daniel Hirscher added a comment -

        Thank you for the XSLT. I could get it running.
        However, the resulting coverage.xml only contains a summary (about 500 bytes file size) - even after upgrading JaCoCo from 0.5.2 to 0.5.7.
        Some numbers differ slightly between the coverage.xml and the JaCoCo HTML Report, like e.g. the covered classes count.

        But this is sufficient to get the jenkins emma plug-in working.
        So, now I can see the trend.

        Thank you very much.

        Show
        ka3was Daniel Hirscher added a comment - Thank you for the XSLT. I could get it running. However, the resulting coverage.xml only contains a summary (about 500 bytes file size) - even after upgrading JaCoCo from 0.5.2 to 0.5.7. Some numbers differ slightly between the coverage.xml and the JaCoCo HTML Report, like e.g. the covered classes count. But this is sufficient to get the jenkins emma plug-in working. So, now I can see the trend. Thank you very much.
        Hide
        tomnelson178 Tom Nelson added a comment -

        Hi Markus, when I try this, I get
        [xslt] : Error! Error checking type of the expression 'funcall(replace, [step("attribute", 22), literal-e
        xpr, literal-expr(.)])'.
        I suspect some XSLT 1.0 vs 2.0, ant jar or some such issue (some sites indicate a fn: namespace), I'm using the saxon9he.jar from your example. Any ideas?

        Show
        tomnelson178 Tom Nelson added a comment - Hi Markus, when I try this, I get [xslt] : Error! Error checking type of the expression 'funcall(replace, [step("attribute", 22), literal-e xpr , literal-expr(.)])'. I suspect some XSLT 1.0 vs 2.0, ant jar or some such issue (some sites indicate a fn: namespace), I'm using the saxon9he.jar from your example. Any ideas?
        Hide
        jfuerth Jonathan Fuerth added a comment -

        Hi there,

        I forked the Emma plugin back in October, and got something that more-or-less works for JaCoCo. It does need a few specific fixes:

        • JaCoCo collects a slightly different set of metrics than Emma does, and the table headings in the template need to be updated
        • the source file line-by-line coverage HTML files have to be included in the produced report
        • a few tests from the original Emma plugin are still failing (I updated most of them already, but some will are invalid for JaCoCo)

        You can take a look at the current state of it here: https://github.com/jfuerth/emma-plugin/tree/jacoco

        Help is very welcome!

        Show
        jfuerth Jonathan Fuerth added a comment - Hi there, I forked the Emma plugin back in October, and got something that more-or-less works for JaCoCo. It does need a few specific fixes: JaCoCo collects a slightly different set of metrics than Emma does, and the table headings in the template need to be updated the source file line-by-line coverage HTML files have to be included in the produced report a few tests from the original Emma plugin are still failing (I updated most of them already, but some will are invalid for JaCoCo) You can take a look at the current state of it here: https://github.com/jfuerth/emma-plugin/tree/jacoco Help is very welcome!
        Hide
        mickael_istria Mickael Istria added a comment -

        On a side note, this topic was suggested as a subject for a GSoC by JBoss (Jonathan is the mentor) https://community.jboss.org/wiki/GSoC12Ideas#A_Jenkins_plugin_to_visualize_Jacoco_code_coverage_reports
        Any help of finding and motivating a student for to work on this in the GSoC context is welcome!

        Show
        mickael_istria Mickael Istria added a comment - On a side note, this topic was suggested as a subject for a GSoC by JBoss (Jonathan is the mentor) https://community.jboss.org/wiki/GSoC12Ideas#A_Jenkins_plugin_to_visualize_Jacoco_code_coverage_reports Any help of finding and motivating a student for to work on this in the GSoC context is welcome!
        Hide
        mickael_istria Mickael Istria added a comment -

        EclEmma plugin for Jacoco reports in Eclipse is great. I guess they have a cool API to parse jacoco.exec files and a cleaner way than turning them into Emma reports with XSL.

        Show
        mickael_istria Mickael Istria added a comment - EclEmma plugin for Jacoco reports in Eclipse is great. I guess they have a cool API to parse jacoco.exec files and a cleaner way than turning them into Emma reports with XSL.
        Hide
        jmhofer Joachim Hofer added a comment -

        Here's some very humble beginnings for a start: https://bitbucket.org/jmhofer/jacoco-jenkins-plugin

        Show
        jmhofer Joachim Hofer added a comment - Here's some very humble beginnings for a start: https://bitbucket.org/jmhofer/jacoco-jenkins-plugin
        Hide
        ognjenb Ognjen Bubalo added a comment -

        This project has been accepted for Google Summer of Code 2012.

        We created a mailing list.

        The URL: https://groups.google.com/forum/?fromgroups#!forum/jenkins-jacoco-plugin-mailing-list
        The Mailing list: jenkins-jacoco-plugin-mailing-list@googlegroups.com

        Join us please

        Show
        ognjenb Ognjen Bubalo added a comment - This project has been accepted for Google Summer of Code 2012. We created a mailing list. The URL: https://groups.google.com/forum/?fromgroups#!forum/jenkins-jacoco-plugin-mailing-list The Mailing list: jenkins-jacoco-plugin-mailing-list@googlegroups.com Join us please
        Hide
        jhespinosa Jose Espinosa added a comment -

        Have anybody run the jacoco_to_emma.xslt file on maven?

        When I run it I get the following error:

        [INFO] --- xml-maven-plugin:1.0:transform (default) @ my-app ---
        ERROR:  'Error checking type of the expression 'funcall(replace, [step("attribute", 22), literal-expr(/), literal-expr(.)])'.'
        FATAL ERROR:  'Could not compile stylesheet'
        [INFO] ------------------------------------------------------------------------
        [INFO] BUILD FAILURE
        [INFO] ------------------------------------------------------------------------
        [INFO] Total time: 19.400s
        [INFO] Finished at: Thu Jun 07 17:04:31 PDT 2012
        [INFO] Final Memory: 20M/81M
        [INFO] ------------------------------------------------------------------------
        [ERROR] Failed to execute goal org.codehaus.mojo:xml-maven-plugin:1.0:transform (default) on project my-app: Failed to parse stylesheet javax.xml.transform.sax.SAXSource@233aa44: Could not compile stylesheet -> [Help 1]
        

        Any pointers? Thanks!

        Show
        jhespinosa Jose Espinosa added a comment - Have anybody run the jacoco_to_emma.xslt file on maven? When I run it I get the following error: [INFO] --- xml-maven-plugin:1.0:transform ( default ) @ my-app --- ERROR: 'Error checking type of the expression 'funcall(replace, [step( "attribute" , 22), literal-expr(/), literal-expr(.)])'.' FATAL ERROR: 'Could not compile stylesheet' [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 19.400s [INFO] Finished at: Thu Jun 07 17:04:31 PDT 2012 [INFO] Final Memory: 20M/81M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.codehaus.mojo:xml-maven-plugin:1.0:transform ( default ) on project my-app: Failed to parse stylesheet javax.xml.transform.sax.SAXSource@233aa44: Could not compile stylesheet -> [Help 1] Any pointers? Thanks!
        Hide
        schlegel_m Markus Schlegel added a comment -

        Hi Jose
        I do not know maven, and you did not provide the maven-config...
        I have the xslt still in use (with ant), the only thing I changed in the meantime is, that I use "BRANCH" instead of "COMPLEXITY" on line 102.

        Show
        schlegel_m Markus Schlegel added a comment - Hi Jose I do not know maven, and you did not provide the maven-config... I have the xslt still in use (with ant), the only thing I changed in the meantime is, that I use "BRANCH" instead of "COMPLEXITY" on line 102.
        Hide
        mickael_istria Mickael Istria added a comment -

        @Jose: you should use the jacoco plugin which is already available in version 0.1. See Ognjen's comment for useful links on this topic.

        Show
        mickael_istria Mickael Istria added a comment - @Jose: you should use the jacoco plugin which is already available in version 0.1. See Ognjen's comment for useful links on this topic.
        Hide
        mickael_istria Mickael Istria added a comment -
        Show
        mickael_istria Mickael Istria added a comment - Link to Jacoco reports plugin: https://wiki.jenkins-ci.org/display/JENKINS/JaCoCo+Plugin

          People

          • Assignee:
            ognjenb Ognjen Bubalo
            Reporter:
            ka3was Daniel Hirscher
          • Votes:
            25 Vote for this issue
            Watchers:
            20 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: