Emma Plugin

Plugin Information

Plugin ID emma
Latest Release 1.20
Latest Release Date Mar 19, 2010
Changes via Fisheye In Latest Release
Since Latest Release
Maintainer(s) n/a (id: manolo)
Issue Tracking Open Issues

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

Change Log

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)

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.

Hudson 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

Version 1.9 (Apr 6, 2009)

  • Emma plugin now works with the Maven2 project type (issue #3424)

Labels:

plugin-report plugin-report Delete
Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.
  1. Apr 03, 2009

    Sarthak says:

    Hi, Can we make the Emma plugin compatible with maven projects? Currently, I ca...

    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. Apr 12, 2009

    Frank says:

    The coverage trend is useful, but I would really like to get Hudson to display t...

    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. Mar 07

      Manuel Carrasco says:

      Updated this wiki page with a explanation about how to archive html files genera...

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

  3. May 06, 2009

    Gary says:

    I am trying to install this plugin on Hudson version 1.276. It looks to be insta...

    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. Jun 10, 2009

    Carolyn Teo says:

    Hi I had 2 concerns about Emma :   Emma was install in Hudson but the hel...

    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! 

    1. Mar 07

      Manuel Carrasco says:

      Done in version 1.12

      Done in version 1.12

  5. Jul 14, 2009

    Thomas Jonsson says:

    Hi! How about this plugin and multi-module maven projects? I can't come up ...

    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. Mar 07

      Manuel Carrasco says:

      Fixed in version 1.12

      Fixed in version 1.12

  6. Dec 02, 2009

    Bruno Bonacci says:

    I do agree with above Thomas  and Carolyne comments. The plugin currently d...

    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. Mar 07

      Manuel Carrasco says:

      Fixed in version 1.12, you can specify multiple files or leave the plugin look f...

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

  7. Jan 29, 2010

    Bitard Michaël says:

    Hi, Since the last update, we get an error : FATAL: java.lang.String.isEmpty()...

    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. Feb 21, 2010

      Himanshu Varsheny says:

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

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

      Thanks,

      Himanshu

      1. Feb 21, 2010

        Himanshu Varsheny says:

        oops.. I see http://issues.hudson-ci.org/browse/HUDSON-5440 already filed for th...

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

  8. Feb 22, 2010

    Mike Machado says:

    When I enabled this plugin in my maven2 project and then added "emma:emma" to my...

    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. Mar 07

      Manuel Carrasco says:

      do you do a mvn clean?

      do you do a mvn clean?

    2. Mar 10

      Mirko Friedenhagen says:

      Hello, maybe they are run twice: once without coverage and once with coverage ....

      Hello,

      maybe they are run twice: once without coverage and once with coverage . 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. Apr 07

    Christian Gruenberg says:

    Hi, I like to setup a multimodule-maven2 job with emma. But only to use the goa...

    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. Apr 07

    Manuel Carrasco says:

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

    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. Apr 15

    Klobetime says:

    How can I get the emma trend graph to appear on the main project page with the o...

    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. Apr 15

      Manuel Carrasco says:

      It's not possible right now. I think it is a nice feature, so I'll put it in th...

      It's not possible right now.

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

      -Manolo

  12. Apr 29

    Subhashish says:

    Hi, I use the Emma plugin and find it's health reporting feature really useful. ...

    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. Jul 27

    Adam Szecowka says:

    How coverage report is generated ? I have problem, because on X axis I can see o...

    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. Aug 05

    Franck POUPELIN says:

    In order to improve Internet Explorer render simply remove in the emma style she...

    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