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

XML report file generated by CloverPHP plugin is not fully compatible with Clover format

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • cloverphp-plugin
    • None

      We use PHPUnit to generate a clover-like XML File. Then I use the clover-plugin to evaluate it.

      As you can see in the first screenshot, the displayed result shows some total coverage, but there is no detailed information. Coverage breakdown defaults to 0/0 for every package.

      Clicking on a package leads to an

      "Problem accessing /job/INEW_BlueOcean/64/clover/AppBundle/Traits/. Reason:

      Not Found"

       

      Maybe it has something to do with the fact, that these packages are no packages (in java sense of the word) but only directories to group the classes.

      Maybe the generated XML File is not correct, but I don't know how to tell.

          [JENKINS-42759] XML report file generated by CloverPHP plugin is not fully compatible with Clover format

          jay rawal added a comment -

          I am having similar issues, is there any progress on this bug? or any information on how to get around this problem?

          jay rawal added a comment - I am having similar issues, is there any progress on this bug? or any information on how to get around this problem?

          Marek Parfianowicz added a comment - - edited

          Why did you not use the https://wiki.jenkins.io/display/JENKINS/Clover+PHP+Plugin for PHP?

          Using Clover (which is designed for Java/Groovy) to parse PHP coverage results is a bit hacky...

          Marek Parfianowicz added a comment - - edited Why did you not use the https://wiki.jenkins.io/display/JENKINS/Clover+PHP+Plugin  for PHP? Using Clover (which is designed for Java/Groovy) to parse PHP coverage results is a bit hacky...

          Can you attach the generated XML file?

          Marek Parfianowicz added a comment - Can you attach the generated XML file?

          Clover PHP Plugin is not working with pipelines.

          In the meantime I use a publishHTML step, to include a HTML Report from Codeception.

           

          But If you would look at it, I would appreciate that. clover.xml

          Paul Garstenauer added a comment - Clover PHP Plugin is not working with pipelines. In the meantime I use a publishHTML step, to include a HTML Report from Codeception.   But If you would look at it, I would appreciate that. clover.xml

          I think I know what's wrong with CloverPHP report. The original Clover report has <metrics> tag for every element (project, package, file, class). Example:

          <coverage generated="1516352044079" clover="4.0.6">
             <project timestamp="1516352041781">
                <metrics coveredelements="0" complexity="0" loc="3" methods="0" classes="1" statements="0" packages="1" coveredconditionals="0" coveredmethods="0" elements="0" ncloc="0" files="1" conditionals="0" coveredstatements="0"/>
                <package name="default-pkg">
                   <metrics coveredelements="0" complexity="0" loc="3" methods="0" classes="1" statements="0" coveredconditionals="0" coveredmethods="0" elements="0" ncloc="0" files="1" conditionals="0" coveredstatements="0"/>
                   <file path="/Users/mparfianowicz/Work/development/clover-examples/spock-example/src/main/groovy/Foo.groovy" name="Foo.groovy">
                      <metrics coveredelements="0" coveredconditionals="0" complexity="0" loc="3" coveredmethods="0" methods="0" elements="0" classes="1" ncloc="0" statements="0" conditionals="0" coveredstatements="0"/>
                      <class name="Foo">
                         <metrics coveredelements="0" coveredconditionals="0" complexity="0" coveredmethods="0" methods="0" elements="0" statements="0" conditionals="0" coveredstatements="0"/>
                      </class>
                   </file>
                </package>
             </project>
          

          and in the report attached by you the <metrics> tag is available only for a class:

          <coverage generated="1515463459">
            <project timestamp="1515463459">
              <package name="AppBundle">
                <file name="C:\Apache24\htdocs\inew\src\AppBundle/AppBundle.php">
                  <class name="AppBundle" namespace="AppBundle">
                    <metrics complexity="0" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="0" coveredelements="0"/>
                  </class>
                  <metrics loc="9" ncloc="9" classes="0" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="0" coveredelements="0"/>
                </file>
              </package>
          

          You should fix the XML report generated by CloverPHP plugin. Just aggregate metrics and add the new metrics tag to the parent (i.e. sum <metrics> from <class> and put under <file>; next sum <metrics> from <file> and put under <package> etc).

          Marek Parfianowicz added a comment - I think I know what's wrong with CloverPHP report. The original Clover report has <metrics> tag for every element (project, package, file, class). Example: <coverage generated= "1516352044079" clover= "4.0.6" >    <project timestamp= "1516352041781" >       <metrics coveredelements= "0" complexity= "0" loc= "3" methods= "0" classes= "1" statements= "0" packages= "1" coveredconditionals= "0" coveredmethods= "0" elements= "0" ncloc= "0" files= "1" conditionals= "0" coveredstatements= "0" />       <package name= "default-pkg" >          <metrics coveredelements= "0" complexity= "0" loc= "3" methods= "0" classes= "1" statements= "0" coveredconditionals= "0" coveredmethods= "0" elements= "0" ncloc= "0" files= "1" conditionals= "0" coveredstatements= "0" />          <file path= "/Users/mparfianowicz/Work/development/clover-examples/spock-example/src/main/groovy/Foo.groovy" name= "Foo.groovy" >             <metrics coveredelements= "0" coveredconditionals= "0" complexity= "0" loc= "3" coveredmethods= "0" methods= "0" elements= "0" classes= "1" ncloc= "0" statements= "0" conditionals= "0" coveredstatements= "0" />             <class name= "Foo" >                <metrics coveredelements= "0" coveredconditionals= "0" complexity= "0" coveredmethods= "0" methods= "0" elements= "0" statements= "0" conditionals= "0" coveredstatements= "0" />             </class>          </file>       </package>    </project> and in the report attached by you the <metrics> tag is available only for a class: <coverage generated= "1515463459" > <project timestamp= "1515463459" > <package name= "AppBundle" > <file name= "C:\Apache24\htdocs\inew\src\AppBundle/AppBundle.php" > <class name= "AppBundle" namespace= "AppBundle" > <metrics complexity= "0" methods= "0" coveredmethods= "0" conditionals= "0" coveredconditionals= "0" statements= "0" coveredstatements= "0" elements= "0" coveredelements= "0" /> </class> <metrics loc= "9" ncloc= "9" classes= "0" methods= "0" coveredmethods= "0" conditionals= "0" coveredconditionals= "0" statements= "0" coveredstatements= "0" elements= "0" coveredelements= "0" /> </file> </package> You should fix the XML report generated by CloverPHP plugin. Just aggregate metrics and add the new metrics tag to the parent (i.e. sum <metrics> from <class> and put under <file>; next sum <metrics> from <file> and put under <package> etc).

          Upkar Rai added a comment -

          Is there a workaround ?

          Upkar Rai added a comment - Is there a workaround ?

            Unassigned Unassigned
            p_garstenauer Paul Garstenauer
            Votes:
            4 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: