Emma Plugin

Plugin Information

Plugin ID emma
Latest Release 1.17
Latest Release Date Mar 09, 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.

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

Change Log

Version 1.16 (Mar 7, 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 (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

    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

    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

      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

        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

    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