Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Not A Bug
    • Affects Version/s: EMMA-1.0.1, EMMA-1.1
    • Fix Version/s: EMMA-1.1
    • Component/s: Emma
    • Labels:
      None
    • Environment:
      Linux Ubuntu x86_64
    • Number of attachments :
      1

      Description

      I doubt this is really a bug... but I'm not sure where to post a question to get a recommendation of how to resolve this.
      I apologize if this is the wrong place to post this.

      I'm using Sonar 2.5
      Emma 2.1.5320
      Sonar Emma plugin 1.1.

      I run my unit tests with the emma code coverage enabled prior to running the Sonar analysis.
      The coverage.em and coverage.ec file are created and in the location that I've specified in my pom.xml file.
      The emma reports can be generated and they indicate 1% code coverage... so I know that is working properly.

      Here are the relevant pom entries:

      <plugin>
      <groupId>org.codehaus.sonar-plugins</groupId>
      <artifactId>sonar-emma-plugin</artifactId>
      <version>1.1</version>
      </plugin>

      <properties>
      <!-- setting for running unittest/class analysis-->
      <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
      <sonar.core.codeCoveragePlugin>emma</sonar.core.codeCoveragePlugin>
      <sonar.emma.reportPath>tests/emma/coverage</sonar.emma.reportPath>
      <sonar.surefire.reportsPath>tests/junit/reports</sonar.surefire.reportsPath>

      When I run the sonar analysis I don't get an errors in the output.
      The sonar report acknowledges the unit test results, but still says 0.0% code coverage.

      I've attached my sonar output.

      Can anyone offer a suggestion as to why the code coverage data isn't acknowledged in the Sonar analysis?

      Thanks,
      -Jon

        Issue Links

          Activity

          Hide
          Jon Lachelt added a comment -

          I stumbled on an answer to this question (at www.opensubscriber.com/message/ajug...org/14720725.html - careful this web site also shows all sorts of explicit nude photos).

          Someone else was having the same problem and they looked at the source for the plugin, and found that the ec file needed to be called "coverage_0.ec". They didn't explain why this was the case. But I changed the name of my file to that, and now Sonar is showing the correct coverage data.

          The strange thing is, if the file has the name "coverage.ec" (which is what you'd expect) and if that file was created with a non-matching version of the emma plugin, then the plugin complains that the file isn't of the expected format. So it clearly finds the file even with the name "coverage.ec". Then if you switch to using the matching version of Emma to do the coverage analysis (but still use the file name "coverage.ec") it stops complaining about the mis-matched format... but also seems to ignore the data and report 0.0% coverage.

          Simply switching the file name to coverage_0.ec (and using a matching emma) solves the problem.

          Show
          Jon Lachelt added a comment - I stumbled on an answer to this question (at www.opensubscriber.com/message/ajug...org/14720725.html - careful this web site also shows all sorts of explicit nude photos). Someone else was having the same problem and they looked at the source for the plugin, and found that the ec file needed to be called "coverage_0.ec". They didn't explain why this was the case. But I changed the name of my file to that, and now Sonar is showing the correct coverage data. The strange thing is, if the file has the name "coverage.ec" (which is what you'd expect) and if that file was created with a non-matching version of the emma plugin, then the plugin complains that the file isn't of the expected format. So it clearly finds the file even with the name "coverage.ec". Then if you switch to using the matching version of Emma to do the coverage analysis (but still use the file name "coverage.ec") it stops complaining about the mis-matched format... but also seems to ignore the data and report 0.0% coverage. Simply switching the file name to coverage_0.ec (and using a matching emma) solves the problem.
          Hide
          Jon Lachelt added a comment -

          I'd still like someone who understands the reason behind this unexpected behavior to explain what's going on. I'd rather not have to read the source code to figure it out. And someone should post this information on the Sonar Emma Plugin web page: http://docs.codehaus.org/display/SONAR/Sonar+Emma+Plugin

          Show
          Jon Lachelt added a comment - I'd still like someone who understands the reason behind this unexpected behavior to explain what's going on. I'd rather not have to read the source code to figure it out. And someone should post this information on the Sonar Emma Plugin web page: http://docs.codehaus.org/display/SONAR/Sonar+Emma+Plugin
          Hide
          Jon Lachelt added a comment -

          Correction, the file must be called "coverage-0.ec".

          Show
          Jon Lachelt added a comment - Correction, the file must be called "coverage-0.ec".
          Hide
          Sébastien Alonzo added a comment -

          I just looked at the code and I confirm that the coverage file name is hardcoded to "coverage-0.ec".
          I could only assume that it's a default value and the code is not complete yet. Nevertheless what bugs me more is that the plugin documentation (not in the Wiki but in sonar webapp) states that the sonar.emma.reportPath should point to a folder containing Emma XML reports whereas the plugin actually looks for .ec and .em files.

          Show
          Sébastien Alonzo added a comment - I just looked at the code and I confirm that the coverage file name is hardcoded to "coverage-0.ec". I could only assume that it's a default value and the code is not complete yet. Nevertheless what bugs me more is that the plugin documentation (not in the Wiki but in sonar webapp) states that the sonar.emma.reportPath should point to a folder containing Emma XML reports whereas the plugin actually looks for .ec and .em files.
          Hide
          Olivier Gaudin added a comment -

          Ok, as this issue is resolved I will close it. Feel free to create subsequent issue for ducmentation and being able to pass the file name as a parameter

          Show
          Olivier Gaudin added a comment - Ok, as this issue is resolved I will close it. Feel free to create subsequent issue for ducmentation and being able to pass the file name as a parameter
          Hide
          Freddy Mallet added a comment -

          I've created issue SONARPLUGINS-1318 to stop hardcoding this report file name.

          Show
          Freddy Mallet added a comment - I've created issue SONARPLUGINS-1318 to stop hardcoding this report file name.

            People

            • Assignee:
              Unassigned
              Reporter:
              Jon Lachelt
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: