Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2
    • Fix Version/s: 2.7
    • Labels:
      None
    • Environment:
      Windows XP, maven 2.0.8
    • Testcase included:
      yes
    • Patch Submitted:
      Yes
    • Number of attachments :
      5

      Description

      In my project, I have both unit tests ("test" phase) and integration tests ("integration-test" phase).
      So far I could manage configuring maven-surefire-plugin and maven-surefire-report-plugin to execute both tests correctly and also generate 2 different reports.
      Then I have added cobertura-maven-plugin to the reporting in order to get coverage but unfortunately only unit tests have their coverage reported (I know it because I have some classes which are only integration tested but are reported as 0% covered).
      After trying to find information on the mailing lists, on the web and other existing resources, I could not find any hint on how to make this work.
      It looks like cobertura-maven-plugin, by its current design, will never run integration-test to collect coverage, it seems to stop at the "test" phase.

      Thus whenever a POM project has integration tests and uses cobertura-maven-plugin for coverage report, the generated reports are wrong, which is very misleading.

      Actually, I was surprised not to find this issue already in JIRA.

      Is there a chance this gets fixed soon? Or is there a usable workaround for this problem (besides switching to clover which I am not sure it would work better ) Did someone succeed in patching cobertura-maven-plugin to get the correct behavior?

        Issue Links

          Activity

          Hide
          Dennis Lundberg added a comment - - edited

          Hi,

          Today I needed the ability to measure test coverage for integration tests. I have applied CoberturaIntegrationReportMojo.patch and cobertura-maven-plugin_check-only-and-report-only-mojos_with-IT.patch locally, and made some adjustments because the code in SVN has changed since the patches were made. After that I could get a very welcome coverage report for our integration tests.

          I would like to apply the integration test coverage bits to trunk, however looking at the patches I have a few questions.

          In CoberturaIntegrationReportMojo.patch there is a new Mojo that can be used to measure coverage for integration tests, like the subject is for this issue. Am I correct when I say that this is the only patch that I need to apply to solve this issue?

          In cobertura-maven-plugin_check-only-and-report-only-mojos_with-IT.patch there are a couple of new Mojos CoberturaReportOnlyMojo and CoberturaCheckOnlyMojo complete with integration test. But I don't quite understand their purpose, in relation to integration tests. Are they in fact an entirely different issue? Also their Javadoc are exactly the same as the mojos they extend, which makes it hard to understand what they do.

          Show
          Dennis Lundberg added a comment - - edited Hi, Today I needed the ability to measure test coverage for integration tests. I have applied CoberturaIntegrationReportMojo.patch and cobertura-maven-plugin_check-only-and-report-only-mojos_with-IT.patch locally, and made some adjustments because the code in SVN has changed since the patches were made. After that I could get a very welcome coverage report for our integration tests. I would like to apply the integration test coverage bits to trunk, however looking at the patches I have a few questions. In CoberturaIntegrationReportMojo.patch there is a new Mojo that can be used to measure coverage for integration tests, like the subject is for this issue. Am I correct when I say that this is the only patch that I need to apply to solve this issue? In cobertura-maven-plugin_check-only-and-report-only-mojos_with-IT.patch there are a couple of new Mojos CoberturaReportOnlyMojo and CoberturaCheckOnlyMojo complete with integration test. But I don't quite understand their purpose, in relation to integration tests. Are they in fact an entirely different issue? Also their Javadoc are exactly the same as the mojos they extend, which makes it hard to understand what they do.
          Hide
          Stevo Slavic added a comment -

          Issue created in March 2008, patch you're commenting was added in 2009, and now is almost 2015....
          I'm not sure if issue is relevant any more at all. I'm not using cobertura anymore, partially because it took so long to get attention to this issue; jacoco works for me.
          So, AFAIAC you can ignore patch. Removed my vote.

          Show
          Stevo Slavic added a comment - Issue created in March 2008, patch you're commenting was added in 2009, and now is almost 2015.... I'm not sure if issue is relevant any more at all. I'm not using cobertura anymore, partially because it took so long to get attention to this issue; jacoco works for me. So, AFAIAC you can ignore patch. Removed my vote.
          Hide
          Dennis Lundberg added a comment -

          Digging some more into the code it looks like we will also need a CoberturaIntegrationTestCheckMojo that extends the CoberturaCheckMojo, but with a different execution phase.

          The clean, dump-datafile and instrument goals does not appear to require any changes.

          Show
          Dennis Lundberg added a comment - Digging some more into the code it looks like we will also need a CoberturaIntegrationTestCheckMojo that extends the CoberturaCheckMojo , but with a different execution phase. The clean , dump-datafile and instrument goals does not appear to require any changes.
          Hide
          Dennis Lundberg added a comment -

          Two new goals were added in r20181:

          • cobertura-integration-test (based on the patch by Stevo Slavic)
          • check-integration-test

          They extend the cobertura and check goals, but change the execution phase so that integration tests are also included in the Cobertura analysis.

          I will push new SNAPSHOTs to the snapshot repo a little later, so that people can test it out.

          Show
          Dennis Lundberg added a comment - Two new goals were added in r20181: cobertura-integration-test (based on the patch by Stevo Slavic) check-integration-test They extend the cobertura and check goals, but change the execution phase so that integration tests are also included in the Cobertura analysis. I will push new SNAPSHOTs to the snapshot repo a little later, so that people can test it out.
          Hide
          Dennis Lundberg added a comment -

          A SNAPSHOT has now been deployed to
          https://nexus.codehaus.org/content/repositories/snapshots/

          Please try it out!

          Show
          Dennis Lundberg added a comment - A SNAPSHOT has now been deployed to https://nexus.codehaus.org/content/repositories/snapshots/ Please try it out!

            People

            • Assignee:
              Dennis Lundberg
              Reporter:
              Jean-Francois Poilpret
            • Votes:
              67 Vote for this issue
              Watchers:
              51 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: