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

Cobertura plugin is not able to find code from python coverage

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

      Our repository has all src code under /src. So when running tests and coverage the coverage.xml file is generated in $WORKSPACE/src. In the job config I specify **/coverage.xml in the location. Th eCobertura plugin finds the coverage report but states:

      Source code is unavailable. Some possible reasons are:

      This is not the most recent build (to save on disk space, this plugin only keeps the most recent builds source code).
      Cobertura found the source code but did not provide enough information to locate the source code.
      Cobertura could not find the source code, so this plugin has no hope of finding it.

      I believe this is due to the fact that coverage.xml records the relative path to the files. As this file is in $WORKSPACE/src I would expect it to find the files in $WORKSPACE/src/<relative path>, but I susepct it's omitting the 'src' directory.

          [JENKINS-13889] Cobertura plugin is not able to find code from python coverage

          cangove created issue -

          sogabe added a comment -

          would you attach your coverage.xml?

          sogabe added a comment - would you attach your coverage.xml?

          cangove added a comment -

          Here is an example of one of our coverage.xml reports. Produced via http://pypi.python.org/pypi/coverage.

          cangove added a comment - Here is an example of one of our coverage.xml reports. Produced via http://pypi.python.org/pypi/coverage .
          cangove made changes -
          Attachment New: coverage.xml [ 21873 ]

          sogabe added a comment -

          attached coverage.xml which is generated by cobertura.

          sogabe added a comment - attached coverage.xml which is generated by cobertura.
          sogabe made changes -
          Attachment New: coverage_by_cobertura.xml [ 21886 ]

          sogabe added a comment -

          You can see <sources>/<source> elements in my coverage.xml generated by cobertura.
          Cobertura plugin is looking for source code using a value of "sources/source". However your coverage.xml which is generated by coverage.py doesn't have them.

          I think coverage.py should fix it.

          sogabe added a comment - You can see <sources>/<source> elements in my coverage.xml generated by cobertura. Cobertura plugin is looking for source code using a value of "sources/source". However your coverage.xml which is generated by coverage.py doesn't have them. I think coverage.py should fix it.

          cangove added a comment -

          Thanks! That makes sense. So I can prep the proper report and possible fix for coverage, do the paths in <sources> need to be absolute or can they be relative to the coverage report?

          cangove added a comment - Thanks! That makes sense. So I can prep the proper report and possible fix for coverage, do the paths in <sources> need to be absolute or can they be relative to the coverage report?

          Jens Müller added a comment -

          Yes. Please provide proper documentation about what kind of paths the plugin expects ...

          (I just a thread to the jenkins Google Group about this as well.)

          Jens Müller added a comment - Yes. Please provide proper documentation about what kind of paths the plugin expects ... (I just a thread to the jenkins Google Group about this as well.)

          Jens Müller added a comment -

          And I should add that I use an absolute path for the <source> element and paths relative to it for the filename attribute, as in the attached example produced by Cobertura. And still I get the error message about missing source code.

          Jens Müller added a comment - And I should add that I use an absolute path for the <source> element and paths relative to it for the filename attribute, as in the attached example produced by Cobertura. And still I get the error message about missing source code.

            stephenconnolly Stephen Connolly
            cangove cangove
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: