Child pages
  • Emma Plugin
Skip to end of metadata
Go to start of metadata

Plugin Information

View Emma on the plugin site for more information.

This plugin allows you to capture code coverage report from Emma. Jenkins will generate the trend report of coverage.

This functionality is replaced by the JaCoCo Plugin now!

Usage with Maven2

1. With maven 2.2.x you don't need to add anything to your POM file.

2. Add the "emma:emma" goal to your build to generate Emma reports.

Jenkins Configuration

1.- Add "emma:emma" goal to your maven Build
2.- Enable recording Emma coverage report, and configure it.

3.- Optional: if you want to store html coverage files generated by Emma, configure a post-build action to do that.

Usage with ANT

1.- Create the taskdef and other necessary information for ANT:

 <property name="coverage.dir" value="${basedir}/coverage" />
 <property name="emma.dir" value="/usr/bin/emma" />
 <property name="src.dir" value="${basedir}/src/"/>
 <property name="class.dir" value="${basedir}/class/"/>
 <property name="instrumented.dir" value="${basedir}/inst/"/>
 <path id="emma.lib">
     <fileset dir="${emma.dir}">
         <include name="*.jar"/>
     </fileset>
 </path>
   
 <taskdef resource="emma_ant.properties" classpathref="emma.lib" />

coverage.dir is the location emma will generate the report data to, and emma.dir should be the location of the emma binaries on your system. src.dir is the location of your source files, class.dir is the location of your binary files to be instrumented, and instrumented.dir is the location to store the instrumented binaries.

2.- Tell emma where to find the code to instrument, and the new location to place that code. Note that you must instrument the code before running tests on it.

 <emma enabled="true">
     <instr instrpath="${class.dir}" destdir="${instrumented.dir}" metadatafile="${coverage.dir}/metadata.emma" merge="true">
         <filter excludes="au.com.jenisys.view.*"/>
     </instr>
 </emma>

Use instrpathref instead of instrpath in conjunction with a previously-defined path for more complex setups. Use the filter nested element to include or exclude certain code from being instrumented. For more information on the instr element, see http://emma.sourceforge.net/reference/ch02s03.html

3.- After the instrumented code has been run, tell emma how to prepare the reports:

 <emma enabled="true" >
     <report sourcepath="${src.dir}" >
         <fileset dir="${coverage.dir}" >
             <include name="*.emma" />
         </fileset>

         <xml outfile="${coverage.dir}/coverage.xml" depth="method"/>
     </report>
 </emma>

This will generate an xml report, to the method depth of detail. For more information on the report element, see http://emma.sourceforge.net/reference/ch02s04.html

Change Log

Version 1.28 (May 21, 2012)

  • Do not sort "Total" row.
  • Sort line numerically.
  • Don't include jobs which doesn't have a coverage in dashboard.

Version 1.27 (May 5, 2012)

  • Enable development in Eclipse under M2E plugin (pull request #2).
  • Failed to load hudson.plugins.emma.portlet.grid.EmmaBuilderGrid$EmmaGridDescriptor (JENKINS-12447).
  • Failed to load hudson.plugins.emma.portlet.chart.EmmaBuilderTrendChart$DescriptorImpl (JENKINS-8839).
  • Emma plugin causes maven release job to fail (JENKINS-10236).

Version 1.26 (Oct 18, 2011)

  • Fixed broken image link on config screen.
  • expand job parameters for report search path (JENKINS-11351).
  • bumped dashboard plugin.
  • added test class.

Version 1.25 (May 11, 2011)

  • Fixed a NPE that could be thrown when parsing fails due to malformed coverage.xml files.

Version 1.24 (Feb 8, 2011)

  • Dashboard portlets. Emma portlets for the Dashboard view plugin, a grid and a trend chart.

Version 1.23 (unreleased)

Version 1.21 (Sep 11, 2010)

  • Fixed deprecated API.
  • Added Japanese localization.
  • Restored the floatingBox.jelly which was deleted in previous version.(JENKINS-7383)
  • Help file is missing, so deleted the link.(JENKINS-7381)
  • Added enlarge link.
  • Removed refresh from coverage pages.(JENKINS-7428)

Version 1.20 (Mar 18, 2010)

  • Improve Styling

Version 1.16 (Mar 09, 2010)

  • Fixed sort in tables

Version 1.12 (Feb 21, 2010)

  • Support for multimodule projects
  • Able to automatically look for coverage.xml files in the workspace
  • Internationalization
  • Spanish translation

Version 1.10 (Jun 9, 2009)

  • Remote API improvement (patch)

Version 1.9 (Apr 6, 2009)

  • Emma plugin now works with the Maven2 project type (JENKINS-3424)

32 Comments

  1. Unknown User (sarthak)

    Hi,

    Can we make the Emma plugin compatible with maven projects? Currently, I cant add the emma plugin to my m2 projects. I dont want to use freestyle projects, since I lose all the maven features of dependency management.

    Thanks 

  2. Unknown User (f.copperfield@gmail.com)

    The coverage trend is useful, but I would really like to get Hudson to display the detailed coverage report (available using the <html> element to the <report> element shown above). Could I achieve this by configuring the Sidebar-Link Plugin to point to a location in the build project's workspace?

    1. Updated this wiki page with a explanation about how to archive html files generated by Emma using the 'archive artifacts' plugin.

  3. I am trying to install this plugin on Hudson version 1.276. It looks to be installed correctly but it does not appear in the list of installed plugins.   I then tried to install to install the Sidebae-Link Plugin above and it does appear in the list of installed plugins.

  4. Unknown User (cteo)

    Hi

    I had 2 concerns about Emma :  

    Emma was install in Hudson but the help test does not seem to display properly.

     It seems that Emma does not allow wildcard. Is this a possible addition to Emma?? Because there are individual modules that are build under emma and these generate different statistics. So we wanted to be able to capture them

    Thanks! 

  5. Unknown User (jonssonth)

    Hi!

    How about this plugin and multi-module maven projects? I can't come up with any ideas how to get it to work. Does anyone know if it is possible to invoke post-build actions on a sub module in Hudson?

    Best regards,

    Thomas

    1. Fixed in version 1.12

  6. Unknown User (bruno_bonacci)

    I do agree with above Thomas  and Carolyne comments. The plugin currently doesn't support multi-module maven 2 projects (as you can specify only one coverage.xml).

    The only way is building goal that merge all metadata files together and is pretty ugly and laborious. It would be nice if we can specify an ant fileset (**/*/coverage.e*).

    thanks

    Bruno

    1. Fixed in version 1.12, you can specify multiple files or leave the plugin look for all coverage.xml files in the workspace

  7. Unknown User (mbitard@cvf.fr)

    Hi,

    Since the last update, we get an error :

    FATAL: java.lang.String.isEmpty()Z
    java.lang.NoSuchMethodError: java.lang.String.isEmpty()Z
    at hudson.plugins.emma.EmmaPublisher.perform(EmmaPublisher.java:105)
    at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
    at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:582)
    at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:563)
    at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:550)
    at hudson.model.Build$RunnerImpl.post2(Build.java:152)
    at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:528)
    at hudson.model.Run.run(Run.java:1221)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:122)

    It seems that emma plugin is using java 6.
    Can we have a java 5 version of this plugin?

    Thanks

    Michaël

    1. Just wondering if there has been any resolution or workaround for this problem?

      Thanks,

      Himanshu

      1. oops.. I see http://issues.jenkins-ci.org/browse/JENKINS-5440 already filed for this. Will wait for this to be fixed now :)

  8. Unknown User (mike@machadolab.com)

    When I enabled this plugin in my maven2 project and then added "emma:emma" to my goals, the coverage report works, but now my unit tests are counted twice on the "Test Result Trend" graph. Is there a way to fix that?

    1. do you do a mvn clean?

    2. Hello,

      maybe they are run twice: once without coverage and once with coverage (smile). You may have the case that tests break if coverage is switched on. AFAIK clover wraps the source code for coverage while cobertura does the same with byte code, I do not know about EMMA.

      Regards
      Mirko

  9. Unknown User (grueny)

    Hi,

    I like to setup a multimodule-maven2 job with emma. But only to use the goal emma:emma doesn't produce any emma reports. I only see in the target directory of my modules the files coverage.ec and coverage.em. Can somebody help?

    Regards,

    Christian

  10. Hello,

    Try to execute `mvn clean emma:emma` in your project out of Hudson.

    Normally executing it you will get the files `module/target/coverage*.*`, `module/target/site/emma/coverage.xml` and `module/target/site/emma/index.html`. You will have as many coverage.xml files as modules in your project (note that if the module has not any test, the file is not generated).

    If you don't get this bunch of files, it is an issue with the maven emma plugin.

    Once you have everything working, put your project in Hudson as a maven one, add the emma:emma goal, and enable `record emma reports`, leaving the input box of xml files empty should work, or you can write `**/emma/coverage.xml`

    Cheers
    -Manolo

  11. Unknown User (klobetime)

    How can I get the emma trend graph to appear on the main project page with the other trend graphs?  If I click on "Coverage Report" on the left I can see the trend graph, but I'd like it to appear on the main page on the right along with the Static Analysis and Test Result trend graphs.

    Thanks!

    -mck

    1. It's not possible right now.

      I think it is a nice feature, so I'll put it in the next release.

      -Manolo

  12. Unknown User (subhashish.dutta@misys.com)

    Hi,
    I use the Emma plugin and find it's health reporting feature really useful. It would be good to also be able to set such benchmarks which if violated would cause the builds to be marked as unstable or to be failed. Just like the FindBugs and PMD plugins. Is there any way I can do that now? Else, can you put this as a feature request please?

    Thanks,
    Subhashish

  13. Unknown User (adam.szecowka)

    How coverage report is generated ? I have problem, because on X axis I can see only last build (for example #50) and one previous (#30), and it is always straight line. I want see how coverage was changed during all builds. Where is input data stored ?

  14. Unknown User (franck poupelin)

    In order to improve Internet Explorer render simply remove in the emma style sheet (style.css) this line:

      position: absolute; in the span.text section

    1. Unknown User (may.a.large.rm44@statefarm.com)

      Is there a plan to fix this in a future relase, instead of having to manually change the css?

  15. Unknown User (nithin.nambiar@rbs.com)

    Im using hudson to generate emma coverage report for my multi module project. I noticed that if im having similar package names(com.xyz.util) in multiple modules hudson tend to show only classes from one of the modules in the report. is this a known issue ?

    1. I seem to have the same problem - I have a package which is covered by one of my tests, but the overall report shown by Jenkins shows a coverage of 0% (the coverage report of that single test says 73% for that package).

      Does this plugin "add up" the different coverage results?

  16. I'm not sure if this is the same problem as the one reported above, but I noticed that the coverage reports are showing constant values. It has been working in the beginning (6 months ago) and I didn't notice because we didn't write new tests in the meanwhile. Now I check the emma xml reports and they show the latest additions, but the graphs and reports in Jenkins show no changes. 

    The Jenkins logs don't have any related info. How can I trace the cause of this problem?

    1. Hmmm, weird... Removing tests results in a drop in the coverage shown in the graphs, but there still are classes that have non-zero coverage in the file created by emma and that are shown with zero values in the reports/graphs.

  17. I am trying to use this plugin with a Maven project and I am running into some difficulty getting the plugin to produce coverage reports.

    I have enabled the plugin in Jenkins, add the emma:emma goal to the build and enabled the Record Emma coverage report config (leaving other config entries to defaults)

    I run the build but the build fails with a message indicating that no coverage files were found (see below).

    When I search the workspace I can see the files created by emma instrumentation (coverage.ec and coverage.em).

    Any ideas as to how I can get past this bump in the road

    Thanks

    "Emma: looking for coverage reports in the entire workspace: /Users/peter.hale/.jenkins/jobs/isv-services/workspaceEmma: no coverage files found in workspace. Was any report generated?
    Build step 'Record Emma coverage report' changed build result to FAILURE"

    1. I'm having the same issue, except without coverage.ec being created either.  No coverage.xml is being created.  I was speculating that perhaps the test code is not being executed against the emma instrumented code but against a different compilation, but I'm not sure how to check that.

  18. Is there a way to generate the .ec file on the fly using the plugin and thereby create updated coverage report? I know there is a way to do it from the command line but wanted to check if dynamic report option is available in Emma-Jenkins plugin. Any pointers on this regard will be very much appreciated.

  19. I'm having issues setting up Emma plugin for a simple Maven build. It's a Spring JPA project and all my tests fail if I use the emma:emma goal as instructed- if I remove it they pass without errors. See details here: http://stackoverflow.com/questions/15197743/setting-up-emma-plugin-fails-all-tests-in-jenkins-build