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

Cobertura plugin does not provide data to the REST API

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • cobertura-plugin
    • None

      Accessing data from the Cobertura plugin via the REST API is not possible.

      Hitting the URL http://<jenkins>/job/<name>/<build>/cobertura/api/xml gives:

      <coverageResult><results/></coverageResult>

      and .../api/json gives:

      { results: { } }

      If either depth=2 or appropriate tree argument is given, data is returned, but not all information that is seen on the html pages. Specifically the totals (e.g number of lines) used to generate the ratios is missing. Because of this one cannot determine the relative sizes of the components or the overall size of the project.

          [JENKINS-13877] Cobertura plugin does not provide data to the REST API

          sogabe added a comment -

          use http://<jenkins>/job/<name>/<build>/cobertura/api/xml?depth=2

          sogabe added a comment - use http://<jenkins>/job/<name>/<build>/cobertura/api/xml?depth=2

          Jesse Glick added a comment -

          Better still, use the tree parameter to retrieve exactly those fields you are interested in, rather than relying on whatever the plugin developer thought might be useful at a given depth.

          Jesse Glick added a comment - Better still, use the tree parameter to retrieve exactly those fields you are interested in, rather than relying on whatever the plugin developer thought might be useful at a given depth .

          Depth does indeed work. However, the information given is not complete. Specifically, it gives the coverage ratios, but it doesn't give for example the number of uncovered lines vs. the number of lines, like you can see from the web page. So you can't tell the overall size of the project, nor the size of any particular component.

          Kimon Papahadjopoulos added a comment - Depth does indeed work. However, the information given is not complete. Specifically, it gives the coverage ratios, but it doesn't give for example the number of uncovered lines vs. the number of lines, like you can see from the web page. So you can't tell the overall size of the project, nor the size of any particular component.

          Code changed in jenkins
          User: ssogabe
          Path:
          src/main/java/hudson/plugins/cobertura/targets/CoverageTreeElement.java
          http://jenkins-ci.org/commit/cobertura-plugin/bcc09dbcf541ecab95b68b5dfadd5bc70c9e974b
          Log:
          [FIXED JENKINS-13877] Cobertura plugin does not provide data to the REST API

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: ssogabe Path: src/main/java/hudson/plugins/cobertura/targets/CoverageTreeElement.java http://jenkins-ci.org/commit/cobertura-plugin/bcc09dbcf541ecab95b68b5dfadd5bc70c9e974b Log: [FIXED JENKINS-13877] Cobertura plugin does not provide data to the REST API

            stephenconnolly Stephen Connolly
            joey Joey W
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: