Child pages
  • Clover PHP Plugin
Skip to end of metadata
Go to start of metadata

View Jenkins Clover PHP plugin on the plugin site for more information.

This plugin allows you to capture code coverage reports from PHPUnit. For more information on how to set up PHP projects with Jenkins have a look at the Template for Jenkins Jobs for PHP Projects.

PHPUnit

You have to use "--coverage-clover" option to generate clover style coverage report.
The following setting is for Phing.

build.xml
<exec dir="."
      command="phpunit --log-junit 'reports/unitreport.xml'
                       --coverage-html 'reports/coverage'
                       --coverage-clover 'reports/coverage/coverage.xml'
                       test/"
/>

Or use phpunit task with clover style formatter.

build.xml with phpunit task
<phpunit codecoverage="true" haltonfailure="true" haltonerror="true">
  <formatter type="clover" usefile="false"/>
  <batchtest>
    <fileset dir="tests">
      <include name="**/*Test*.php"/>
    </fileset>
  </batchtest>
</phpunit>

Project configuration

  • the location of clover xml(required).
  • the location of clover html report (optional).

Project screen

TODO

  • Make compatible with pipelines

Changelog

0.5 (20 Nov, 2015)

0.4 (6 Apr, 2015)

  • support variables for configuration.
  • option to generate clover report regardless of build (JENKINS-21046).
  • The CloverPHP red/green coverage bar is too wide (JENKINS-25717).

0.3.3 (21 Mar, 2013)

  • added message if clover xml is incompatible with clover style (JENKINS-17037).
  • Conflict with standard clover plugin (JENKINS-15626).

0.3.2 (21 Oct, 2011)

  • NPE when Clover HTML report directory is not defined (JENKINS-11408).
  • Fixed breadcrumb.
  • Fixed IE6 rendering.

0.3.1 (27 July, 2011)

  • roll back the dependency to Jenkins 1.409 for 1.409.x LTS releases.(Comment).
  • Report page rendering performance boost (pull request).

0.3 (3 Jun, 2011)

  • Support FreeStyle and Matrix projects only.
  • NPE in Clover PHP Plugin when XML config is empty (JENKINS-9821).
  • save clover.xml and html report in builds/XX/cloverphp directory.

0.2 (28 May, 2011)

  • Fixed a path when built on slave.
  • Added breadcrumb.
  • Added test classes.
  • fixed configuration page.

0.1 (16 May, 2011)

  • First release

10 Comments

  1. I installed cloverphp-0.3 in Jenkins 1.416. My clover.xml is under WORKSPACE/build/logs and coverage html reports is under WORKSPACE/build/coverage. I couldn't see the Code Coverage report from project's page as above, with checking both two settings, Publish Clover PHP Coverage Report and Publish HTML Report.

  2. I'm getting a discrepancy between the basic PHPUnit Coverage Report, and the Clover Report. The standard coverage report shows 100%, while the Clover Report shows 80% for methods. I think it's including abstract and/or ignored methods?

  3. I'm also having discrepancy on these two:

    1. Clover HTML Report 

    Clover Code Coverage 99.2% method 1487/1651, conditional 0/0, statement 17883/17883)

    2. Clover Summary Report

    TOTAL                 Lines                     Functions / Methods             Classes

                   100.00% 17488 / 17488         100.00% 1645 / 1645       100.00% 335 / 335

    Can this be fixed?

    Thanks

    Vasyl

  4. Whenever I utilize this plugin my weather reports always follow default values.  No matter what I put into the "Coverage Metric Targets" inputs I am completely bound to the default values for my weather report to change.

    What do I have to do to fix this?

    Example of my problem

  5. I have successfully link Jenkins with Clover PHP.
    With the ‘Coverage Summary Report’ I can see my total code coverage, but I’m not able to see the line coverage in the specific PHP file.

     In the generated ‘phpunit.xml’ I do see line coverage and the amount of hits etc., but Clover somehow doesn’t display it.

     Anything that I’m missing?

  6. Is there a way to get Clover to aggregate multiple coverage report XML files? With PHPUnit, you can give a fileset instead of a single phpunit.xml file and it will combine all the unit test results from the multiple files into one graphical representation.

    In my ant task, I'm already able to gather all the report XML files into the workspace of my job, but there's no way to get Clover to combine all the reports.

  7. It seems like the "Clover XML Location" and "Clover HTML report directory" do not honor placeholders (parameters) such as

    ${MY_PARAMETER}

    I tried using

    ${MY_PARAMETER}/tests/coverage/coverage.xml

    but it didn't get translated to the actual value assigned to the parameter.

    This could be a very useful feature.

    thank you!

  8. Bug report: The width of the green/red bar is set to the width of the container, whereas the width of the graph below it is a fixed pixel size. This can result in broken-looking layout when other things are affecting the width of the container. It would be better for them both to be the same fixed width.

  9. Is there a way to use custom title/label instead of the default "Clover *** Report" or "Code Coverage" (in trend graph)?

    I generate reports from PHP and JS in my project, and there's no way to customize the title/label of the generated output.

    I'm so confused every time I see two reports with the same title/label listed one next to other.

  10. Is the pipeline feature from the todo list schedduled?
    I didn't found any other workarounds to publish my PHP coverage report in pipeline jobs (sad)

Write a comment…