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

Cobertura plugin cannot show file level reports

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • cobertura-plugin
    • * RedHat Linux 2.6
      * Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
      * Jenkins 1.444
      * Jenkins Cobertura Plugin 1.3

      We have a job dedicated to coverage analysis. We use Jenkins Cobertura plugin in this job.

      The workspace directory of that job looks like this:
      <job_directory>/workspace
      <job_directory>/workspace/source
      <job_directory>/workspace/build
      [other subdirectories under workspace]

      We generate coverage.xml with gcovr, in <job_directory>/workspace/build.

      <job_directory>/workspace/build/coverage.xml has the following element:

      <sources>
      <source>
      ../source
      </source>
      </sources>

      which looks correct.

      <job_directory>/workspace/build/coverage.xml refers to source code with elements such as:

      <class [...] filename="foo/bar.cc" [...] name="bar_cc">

      which again looks correct.

      When the job runs, it ends with this message:

      Publishing Cobertura coverage report...
      Publishing Cobertura coverage results...
      Finished: SUCCESS

      The statistics seem correct (at least they vary over time), but when looking at source code level reports of indivual files, we get:

      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 build's 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.

      The reason is that <job_directory>/cobertura is empty.

      One workaround we found was to move coverage.xml from <job_directory>/workspace/build to <job_directory>/workspace (and changing the content of element <source> from ../source to ./source). After doing this single change, <job_directory>/cobertura is populated, and source code level reports of indivual files work.

      To summarize, there are two problems here:

      1) Cobertura plugin ends with a success message ("Publishing Cobertura coverage results..."), although it fails to copy files to <job_directory>/cobertura. This is misleading.

      2) coverage.xml is not allowed to be in a sibling directory of the source directory.

      We may want to have a look at https://issues.jenkins-ci.org/browse/JENKINS-11354, which is somewhat related to this problem.

            Unassigned Unassigned
            dohlsson Dave Ohlsson
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: