SonarQube
  1. SonarQube
  2. SONAR-2392

Combining code coverage results of integration and unit tests for a module

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.3
    • Component/s: Code Coverage
    • Labels:
      None
    • Environment:
      N/a - happens on all environments
    • Number of attachments :
      0

      Description

      It would be excellent to have the integration tests for a component included along with the unit tests in the overall code coverage report for a module.

      For example, a typical Maven 2 project may be

      mycomponent
      mycomponent-integration-tests

      Sonar could generate the combined report for the mycomponent module in one of two ways:

      1. Run Cobertura on mycomponent unit tests with Cobertura - this will produce a cobertura.ser file in the mycomponent/target/cobertura directory.
      2. Run the mycomponent-integration-tests integration tests with Cobertura- this will produce a cobertura.ser file in the mycomponent-integration-tests/target/cobertura directory.
      3. Amalgamate the two cobertura.ser files
      4.Generate the code coverage report for the mycomponent module from the amalgamated cobertura.ser file.

      OR

      1. Run Cobertura on mycomponent unit tests with Cobertura - this will produce a cobertura.ser file in the mycomponent/target/cobertura directory.
      2. Run the mycomponent-integration-tests integration tests with Cobertura, having the results being written to the cobertura.ser file in mycomponent/target/cobertura
      3. Generate the code coverage report for the mycomponent module from the cobertura.ser in mycomponent/target/cobertura.

        Issue Links

          Activity

          Hide
          Mik Quinlan added a comment -

          Um, what happened to the fix version?

          Show
          Mik Quinlan added a comment - Um, what happened to the fix version?
          Hide
          Freddy Mallet added a comment -

          In version 3.3, we'll fix SONAR-2804 which is very close to this ticket except that SONAR-2804 is about Jacoco and SONAR-2392 about Cobertura.

          Show
          Freddy Mallet added a comment - In version 3.3, we'll fix SONAR-2804 which is very close to this ticket except that SONAR-2804 is about Jacoco and SONAR-2392 about Cobertura.
          Hide
          Freddy Mallet added a comment -

          I'm closing this ticket as in fact it duplicates SONAR-2804. This ability to get and play with three different code coverage : unit tests, integration tests, overall code coverage will be available only when using the Sonar Jacoco plugin.

          Show
          Freddy Mallet added a comment - I'm closing this ticket as in fact it duplicates SONAR-2804 . This ability to get and play with three different code coverage : unit tests, integration tests, overall code coverage will be available only when using the Sonar Jacoco plugin.
          Hide
          Daniel Holmes added a comment -

          Just to ask, why do these features have to be coverage tool specific? What is the difficulty in supporting other than JaCoCo?

          Show
          Daniel Holmes added a comment - Just to ask, why do these features have to be coverage tool specific? What is the difficulty in supporting other than JaCoCo?
          Hide
          Freddy Mallet added a comment -

          Hi Daniel, This is coverage tool specific as soon as we want to also merge coverage by branch. Indeed the information contained into Sonar only allows to aggregate the coverage by lines of code. Moreover, computing a code coverage by integration tests is far more straightforward with Jacoco than it is with Cobertura. As in the first case you just need to plug the jacoco agent to the JVM.

          Show
          Freddy Mallet added a comment - Hi Daniel, This is coverage tool specific as soon as we want to also merge coverage by branch. Indeed the information contained into Sonar only allows to aggregate the coverage by lines of code. Moreover, computing a code coverage by integration tests is far more straightforward with Jacoco than it is with Cobertura. As in the first case you just need to plug the jacoco agent to the JVM.

            People

            • Assignee:
              Freddy Mallet
              Reporter:
              Mik Quinlan
            • Votes:
              96 Vote for this issue
              Watchers:
              77 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: