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

Show 100% coverage with a code-less build

    Details

    • Type: Improvement
    • Status: Resolved (View Workflow)
    • Priority: Trivial
    • Resolution: Fixed
    • Component/s: jacoco-plugin
    • Labels:
      None
    • Environment:
      Jenkins 1.604
      JaCoCo plugin 1.0.19
    • Similar Issues:

      Description

      We have build jobs preparing jar files for "modules" that may or may not have actual java code. Sometimes they just have resources. Sometimes previously resource-only modules have code added later.

      Currently our statistics view configured to show the nice coverage percentage (thanks for the great plugin by the way!) shows 0% for the resource only jobs. Yet we also have naughty modules with Java code but no unit tests that show 0% (as they should). It would be great if the modules with no actual code show 100% coverage - since that seems correct in a way and distinct from naughty modules lacking tests

      Unit test coverage still shows N/A so you can easily sort out that the 100% is likely a resource-only job. Or maybe even make an "empty" 100% show in a different text color (blue?) or distinct in some other way.

      Naturally we use template jobs to make it easy to keep all the jobs configured the same. That way the JaCoCo is ready the moment some code actually shows up.

      Thanks in advance! Hoping this is a fairly easy and non-controversial request, but maybe I'm missing something.

        Attachments

          Issue Links

            Activity

            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Kevin Scaldeferri
            Path:
            resources/test/multiple.png
            src/main/java/hudson/plugins/jacoco/model/Coverage.java
            src/test/java/hudson/plugins/jacoco/CoverageTest.java
            src/test/java/hudson/plugins/jacoco/model/CoverageObjectGraphTest.java
            src/test/java/hudson/plugins/jacococoveragecolumn/JaCoCoColumnTest.java
            http://jenkins-ci.org/commit/jacoco-plugin/174dbd90ab3ffbaaceb07664d57649cefc06d97d
            Log:
            Report 100% for empty Coverage objects

            If a section of code has no branches, we should report 100% branch coverage
            not 0% coverage. This prevents spurious threshold violations for such code.

            (This concern also applies to other coverage measures, although in practice
            I've only encountered this problem for branches.)

            Fixes JENKINS-25076 and JENKINS-29117

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kevin Scaldeferri Path: resources/test/multiple.png src/main/java/hudson/plugins/jacoco/model/Coverage.java src/test/java/hudson/plugins/jacoco/CoverageTest.java src/test/java/hudson/plugins/jacoco/model/CoverageObjectGraphTest.java src/test/java/hudson/plugins/jacococoveragecolumn/JaCoCoColumnTest.java http://jenkins-ci.org/commit/jacoco-plugin/174dbd90ab3ffbaaceb07664d57649cefc06d97d Log: Report 100% for empty Coverage objects If a section of code has no branches, we should report 100% branch coverage not 0% coverage. This prevents spurious threshold violations for such code. (This concern also applies to other coverage measures, although in practice I've only encountered this problem for branches.) Fixes JENKINS-25076 and JENKINS-29117
            Hide
            centic centic added a comment - - edited

            We now report 100% for such branches via https://github.com/jenkinsci/jacoco-plugin/pull/79, this will be included in the next release.

            Show
            centic centic added a comment - - edited We now report 100% for such branches via https://github.com/jenkinsci/jacoco-plugin/pull/79 , this will be included in the next release.

              People

              • Assignee:
                ognjenb Ognjen Bubalo
                Reporter:
                cervator Cervator
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: