Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-73765

Difference in the branch coverage reporting versus coverage generator in project using Cobertura

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: Major Major
    • coverage-plugin
    • Jenkins version 2.452.2 running on Windows
      Coverage plugin version 1.10.0

      Hi,

      I'm trying to figure out why there is a difference in the branch coverage reporting of the plugin?

      In my Jenkins console output and Cobertura xml file I'm seeing the following branch metrics: Statements : 25.65% ( 4017/15656 )

      Branches : 19.71% ( 1748/8867 )

      Functions : 19.49% ( 823/4222 )

      Lines : 25.76% ( 3944/15307 )

      <coverage lines-valid="15307" lines-covered="3944" line-rate="0.2576" branches-valid="8867" branches-covered="1748" branch-rate="0.1971" timestamp="1726075067489" complexity="0" version="0.1">

      However, the plugin is giving me the following metrics:

      [Coverage] MODULE: 100.00% (1/1)

      [Coverage] PACKAGE: 87.21% (191/219)

      [Coverage] FILE: 66.67% (380/570)

      [Coverage] CLASS: 66.67% (380/570)

      [Coverage] METHOD: 19.49% (823/4222)

      [Coverage] LINE: 25.73% (3939/15307)

      [Coverage] BRANCH: 18.12% (1061/5857)

      [Coverage] LOC: 15307

       

      As discussed in Gitter chat, I've included the various files as attachments for review.

      Also, the tool generating the Cobertura xml report is vitest with a istanbul provider, and cobertura reporter. I'm running the unit tests and code coverage generation inside a Docker container. It appears that the npm package
      "@vitest/coverage-istanbul": "~2.0.4" is generating the report.

      My command to run the plugin is the following:

      dir('services/frontend')

      {                                         recordCoverage id: 'FE-coverage', name: 'FE Coverage Report', skipSymbolicLinks: false, failOnError: true, checksAnnotationScope: 'SKIP', sourceDirectories: [[path: 'src/**']], qualityGates: [[baseline: 'PROJECT_DELTA', criticality: 'FAILURE', metric: 'PACKAGE'], [baseline: 'PROJECT_DELTA', criticality: 'FAILURE', metric: 'FILE'], [baseline: 'PROJECT_DELTA', criticality: 'FAILURE', metric: 'CLASS'], [baseline: 'PROJECT_DELTA', criticality: 'FAILURE', metric: 'METHOD'], [baseline: 'PROJECT_DELTA', criticality: 'FAILURE', metric: 'LINE'], [baseline: 'PROJECT_DELTA', criticality: 'FAILURE', metric: 'BRANCH']], tools: [[parser: 'COBERTURA', pattern: 'generated/test_coverage/fe/cobertura-coverage.xml']]                                     }

      Let me know if you need more information, thanks for your help.

      Also note that the xml file is a stripped down example, and incomplete.
       
       

        1. cobertura-coverage.xml
          13 kB
          James
        2. ConsoleOutput1.PNG
          163 kB
          James
        3. ConsoleOutput2.PNG
          75 kB
          James

            drulli Ulli Hafner
            jamesmulvenna James
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: