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

Plugin Information

View Clover PHP 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

13 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)

  11. I have 2 projects, one runs PHPUnit 5.x tests and this plugin is able to parse the report just fine, but the other project uses PHPUnit 6.x and the report file fails.

    For now, I had to set the configuration to not fail the project if the report fails, but then I have no report of the test units.

    Here is the output:

    [xUnit] [INFO] - Starting to record.
    [xUnit] [INFO] - Processing PHPUnit-3.x (default)
    [xUnit] [INFO] - [PHPUnit-3.x (default)] - 1 test report file(s) were found with the pattern 'build/logs/junit.xml' relative to '/var/lib/jenkins/workspace/JookSMS-Development' for the testing framework 'PHPUnit-3.x (default)'.
    [xUnit] [ERROR] - There is at least one problem. Check the Jenkins system log for more information. (if you don't have configured yet the system log before, you have to rebuild).
    [xUnit] [INFO] - Processing JUnit
    [xUnit] [INFO] - [JUnit] - 1 test report file(s) were found with the pattern 'build/logs/behat.xml/default.xml' relative to '/var/lib/jenkins/workspace/JookSMS-Development' for the testing framework 'JUnit'.
    [xUnit] [INFO] - Check 'Failed Tests' threshold.
    [xUnit] [INFO] - Check 'Skipped Tests' threshold.
    [xUnit] [INFO] - Setting the build status to SUCCESS
    [xUnit] [INFO] - Stopping recording.
    1. Here is the info from the Jenkins log which has more details:

       

      INFO: [xUnit] - [PHPUnit-3.x (default)] - 1 test report file(s) were found with the pattern 'build/logs/junit.xml' relative to '/var/lib/jenkins/workspace/JookSMS-Development' for the testing framework 'PHPUnit-3.x (default)'.
      May 02, 2018 11:46:26 AM org.jenkinsci.plugins.xunit.service.XUnitService warningSystemLogger
      WARNING: [xUnit] - The file '/var/lib/jenkins/workspace/JookSMS-Development/build/logs/junit.xml' is an invalid file.
      May 02, 2018 11:46:26 AM org.jenkinsci.plugins.xunit.service.XUnitService warningSystemLogger
      WARNING: [xUnit] - At line 46 of file:/var/lib/jenkins/workspace/JookSMS-Development/build/logs/junit.xml:cvc-complex-type.2.4.a: Invalid content was found starting with element 'skipped'. One of '{error, failure, system-err, system-out}' is expected.
      May 02, 2018 11:46:26 AM org.jenkinsci.plugins.xunit.service.XUnitService warningSystemLogger
      WARNING: [xUnit] - At line 54 of file:/var/lib/jenkins/workspace/JookSMS-Development/build/logs/junit.xml:cvc-complex-type.2.4.a: Invalid content was found starting with element 'skipped'. One of '{error, failure, system-err, system-out}' is expected.
      May 02, 2018 11:46:26 AM org.jenkinsci.plugins.xunit.service.XUnitService warningSystemLogger
      WARNING: [xUnit] - At line 64 of file:/var/lib/jenkins/workspace/JookSMS-Development/build/logs/junit.xml:cvc-complex-type.2.4.a: Invalid content was found starting with element 'skipped'. One of '{error, failure, system-err, system-out}' is expected.
      May 02, 2018 11:46:26 AM org.jenkinsci.plugins.xunit.service.XUnitService warningSystemLogger
      WARNING: [xUnit] - At line 67 of file:/var/lib/jenkins/workspace/JookSMS-Development/build/logs/junit.xml:cvc-complex-type.2.4.a: Invalid content was found starting with element 'skipped'. One of '{error, failure, system-err, system-out}' is expected.
      May 02, 2018 11:46:26 AM org.jenkinsci.plugins.xunit.service.XUnitService warningSystemLogger
      WARNING: [xUnit] - At line 72 of file:/var/lib/jenkins/workspace/JookSMS-Development/build/logs/junit.xml:cvc-complex-type.2.4.a: Invalid content was found starting with element 'skipped'. One of '{error, failure, system-err, system-out}' is expected.
      May 02, 2018 11:46:26 AM org.jenkinsci.plugins.xunit.service.XUnitService warningSystemLogger
      WARNING: [xUnit] - At line 77 of file:/var/lib/jenkins/workspace/JookSMS-Development/build/logs/junit.xml:cvc-complex-type.2.4.a: Invalid content was found starting with element 'skipped'. One of '{error, failure, system-err, system-out}' is expected.
      May 02, 2018 11:46:26 AM org.jenkinsci.plugins.xunit.service.XUnitService warningSystemLogger
      WARNING: [xUnit] - At line 85 of file:/var/lib/jenkins/workspace/JookSMS-Development/build/logs/junit.xml:cvc-complex-type.2.4.a: Invalid content was found starting with element 'skipped'. One of '{error, failure, system-err, system-out}' is expected.
      May 02, 2018 11:46:26 AM org.jenkinsci.plugins.xunit.service.XUnitService warningSystemLogger
      WARNING: [xUnit] - At line 88 of file:/var/lib/jenkins/workspace/JookSMS-Development/build/logs/junit.xml:cvc-complex-type.2.4.a: Invalid content was found starting with element 'skipped'. One of '{error, failure, system-err, system-out}' is expected.
      May 02, 2018 11:46:26 AM org.jenkinsci.plugins.xunit.service.XUnitService errorSystemLogger
      SEVERE: [xUnit] - The result file '/var/lib/jenkins/workspace/JookSMS-Development/build/logs/junit.xml' for the metric 'PHPUnit' is not valid. The result file has been skipped.
      May 02, 2018 11:46:26 AM org.jenkinsci.plugins.xunit.service.XUnitService infoSystemLogger
      INFO: [xUnit] - [JUnit] - 1 test report file(s) were found with the pattern 'build/logs/behat.xml/default.xml' relative to '/var/lib/jenkins/workspace/JookSMS-Development' for the testing framework 'JUnit'.

      1. Nevermind, I just realized that is just that the plugin would not process it if there are skipped tests.

Write a comment…