• Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Major Major
    • cobertura-plugin
    • None

      It would be very useful to add support for ratcheting. This would involve making the build job fail or become unstable if the code coverage for a build drops below the code coverage of the previous build. The plugin could keep track of the highest code coverage metrics values from previous builds, and check against this. If the current results are lower, the build fails. If not, the latest values are stored as the new reference values.

      This is very useful for legacy projects, where you want to adopt a Continuous Improvement strategy rather than just imposing a minimum required level of test coverage.

      Thoughts?

          [JENKINS-8326] Support for ratcheting

          Rob Hunter added a comment -

          I'd also like to have support for failing the build when the coverage gets worse than it was.

          I've been looking at different options like:

          • post-build script to re-configure thresholds with Groovy
          • post-build script to re-configure thresholds with HTTP API
          • thresholds use variables ${COBERTURA_MIN_METHOD_COVERAGE} or something

          It'd be super-nice if the Cobertura plugin supported "ratcheting" limits like this but I'd be happy if it were obvious how to source the thresholds from anywhere other than a fixed value in the Web interface.

          (FWIW, I don't think this is a duplicate of JENKINS-11025 – that only covers static thresholds, this ticket covers dynamic thresholds)

          Rob Hunter added a comment - I'd also like to have support for failing the build when the coverage gets worse than it was. I've been looking at different options like: post-build script to re-configure thresholds with Groovy post-build script to re-configure thresholds with HTTP API thresholds use variables ${COBERTURA_MIN_METHOD_COVERAGE} or something It'd be super-nice if the Cobertura plugin supported "ratcheting" limits like this but I'd be happy if it were obvious how to source the thresholds from anywhere other than a fixed value in the Web interface. (FWIW, I don't think this is a duplicate of JENKINS-11025 – that only covers static thresholds, this ticket covers dynamic thresholds)

          I reopened JENKINS-11025 based on your comments.

          IMHO I don't think this plugin is developed actively.

          Ravi Teja Lokineni added a comment - I reopened JENKINS-11025 based on your comments. IMHO I don't think this plugin is developed actively.

          Podar Wang added a comment - - edited

          I have successfully added this feature.
          https://github.com/podarsmarty/cobertura-plugin

          Podar Wang added a comment - - edited I have successfully added this feature. https://github.com/podarsmarty/cobertura-plugin

          Code changed in jenkins
          User: Po-Dar Wang
          Path:
          src/main/java/hudson/plugins/cobertura/CoberturaBuildAction.java
          src/main/java/hudson/plugins/cobertura/CoberturaPublisher.java
          src/main/java/hudson/plugins/cobertura/MavenCoberturaBuildAction.java
          src/main/java/hudson/plugins/cobertura/MavenCoberturaPublisher.java
          src/main/java/hudson/plugins/cobertura/renderers/SourceEncoding.java
          src/main/java/hudson/plugins/cobertura/targets/CoverageTarget.java
          src/main/java/hudson/plugins/cobertura/targets/CoverageTree.java
          src/main/java/hudson/plugins/cobertura/targets/CoverageTreeElement.java
          src/main/resources/hudson/plugins/cobertura/CoberturaPublisher/config.jelly
          src/main/resources/hudson/plugins/cobertura/CoberturaPublisher/config.properties
          src/test/java/hudson/plugins/cobertura/CoverageResultTest.java
          src/test/resources/hudson/plugins/cobertura/coverage-with-lots-of-data.xml
          http://jenkins-ci.org/commit/cobertura-plugin/1cef2b6890bf3388e7e80f12bbe8588035049403
          Log:
          Fixed bug:
          JENKINS-14589

          Added Features:
          JENKINS-11025
          JENKINS-8326

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Po-Dar Wang Path: src/main/java/hudson/plugins/cobertura/CoberturaBuildAction.java src/main/java/hudson/plugins/cobertura/CoberturaPublisher.java src/main/java/hudson/plugins/cobertura/MavenCoberturaBuildAction.java src/main/java/hudson/plugins/cobertura/MavenCoberturaPublisher.java src/main/java/hudson/plugins/cobertura/renderers/SourceEncoding.java src/main/java/hudson/plugins/cobertura/targets/CoverageTarget.java src/main/java/hudson/plugins/cobertura/targets/CoverageTree.java src/main/java/hudson/plugins/cobertura/targets/CoverageTreeElement.java src/main/resources/hudson/plugins/cobertura/CoberturaPublisher/config.jelly src/main/resources/hudson/plugins/cobertura/CoberturaPublisher/config.properties src/test/java/hudson/plugins/cobertura/CoverageResultTest.java src/test/resources/hudson/plugins/cobertura/coverage-with-lots-of-data.xml http://jenkins-ci.org/commit/cobertura-plugin/1cef2b6890bf3388e7e80f12bbe8588035049403 Log: Fixed bug: JENKINS-14589 Added Features: JENKINS-11025 JENKINS-8326

          sogabe added a comment -

          merged. fix in 1.6.

          sogabe added a comment - merged. fix in 1.6.

            pwang25 Podar Wang
            johnsmart johnsmart
            Votes:
            5 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: