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

Cobertura plugin does not publish coverage results for failed build

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • cobertura-plugin
    • None

      When free-style job fails, Cobertura plugin does not publish coverage results, even though they are available in job workspace. "Coverage Report" on the front page of the job refers to last stable build.

      Expected: "Coverage Report" on the front page of the job refers to last build, no matter if it is failed or successful.

      "Consider only stable builds" setting is unchecked in job plugin configuration. If it would be checked, then indeed "Coverage Report" should refer only last stable build.

      Jenkins cobertura plugin v1.9.5.

          [JENKINS-23642] Cobertura plugin does not publish coverage results for failed build

          andrew cooke added a comment -

          FWIW, I am seeing the same. Again, free style. I can (and am) generate a coverage report even though the build fails (actually, the tests fail). The coverage XML is there, but the plugin isn't picking it up. The only option I have set (apart from the path) is to fail if no coverage file is present.

          If I fudge the script so that the build passes (without actually changing anything apart from the shell script exit status) the the plugin works as expected. Unfortunately then Jenkins reports things as OK.

          (What I want/need is coverage when tests are failing).

          andrew cooke added a comment - FWIW, I am seeing the same. Again, free style. I can (and am) generate a coverage report even though the build fails (actually, the tests fail). The coverage XML is there, but the plugin isn't picking it up. The only option I have set (apart from the path) is to fail if no coverage file is present. If I fudge the script so that the build passes (without actually changing anything apart from the shell script exit status) the the plugin works as expected. Unfortunately then Jenkins reports things as OK. (What I want/need is coverage when tests are failing).

          Last two releases (separated by over a year) were by olivergondza so looks like the maintainer

          Stephen Connolly added a comment - Last two releases (separated by over a year) were by olivergondza so looks like the maintainer

          I'd like to add that I'm having the same issue. Build log says;

          Skipping Cobertura coverage report as build was not UNSTABLE or better ...

          But I haven't checked the option to do this.

          Really need this to work: our unit test failures fail the build intentionally, but I still want to update code coverage for the entire project even if one engineer hasn't repaired their unit testing issues.

          Zachary LaCelle added a comment - I'd like to add that I'm having the same issue. Build log says; Skipping Cobertura coverage report as build was not UNSTABLE or better ... But I haven't checked the option to do this. Really need this to work: our unit test failures fail the build intentionally, but I still want to update code coverage for the entire project even if one engineer hasn't repaired their unit testing issues.

          Devashish Chandra added a comment - - edited

          I'd also like to add to the issue,

          I have a job running to collect code coverage metrics, and have defined a threshold for line coverage to fail the build. If the coverage is less than the threshold the build fails, but the coverage report is not published. This coverage report is used by another plugin to send the file wise coverage data to Phabricator, which needs to be done irrespective of whether the job fails or passes. Below is the log I get in my Jenkins job console.

          20:02:39 [Cobertura] Publishing Cobertura coverage report...

          20:02:39 Publishing Cobertura coverage results...

          20:02:39 Cobertura coverage report found.

          20:02:39 Code coverage enforcement failed for the following metrics:

          20:02:39 Lines's stability is 80.44 and set mininum stability is 84.0.

          20:02:39 ERROR: Step ‘Publish Cobertura Coverage Report’ failed: Failing build due to unstability.

          Devashish Chandra added a comment - - edited I'd also like to add to the issue, I have a job running to collect code coverage metrics, and have defined a threshold for line coverage to fail the build. If the coverage is less than the threshold the build fails, but the coverage report is not published. This coverage report is used by another plugin to send the file wise coverage data to Phabricator, which needs to be done irrespective of whether the job fails or passes. Below is the log I get in my Jenkins job console. 20:02:39 [Cobertura] Publishing Cobertura coverage report... 20:02:39 Publishing Cobertura coverage results... 20:02:39 Cobertura coverage report found. 20:02:39 Code coverage enforcement failed for the following metrics: 20:02:39 Lines's stability is 80.44 and set mininum stability is 84.0. 20:02:39 ERROR: Step ‘Publish Cobertura Coverage Report’ failed: Failing build due to unstability.

          Michael Miner added a comment -

          I am still seeing this issue. Has cobertura lost its maintainer. 

          Michael Miner added a comment - I am still seeing this issue. Has cobertura lost its maintainer. 

            Unassigned Unassigned
            dma_k dma_k
            Votes:
            4 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: