Search code examples
phpunitreportsummaryphing

Graphical representation of test results of phpunit


I am using phpunit to do functional tests. I use the log-junit option to generate results in JUnit-XML format. I then use phing to read this XML and generate a HTML report. The report is fine and neat. However, I have two questions:--

  1. Can I also show the results in graphical format in the same JUnit HTML report file(generated by Phing)? A pie chart or any other chart for that matter? (In terms of passed to failed tests)
  2. The JUnit summary which is generated by using the option -log-junit when running PHPUnit tests shows the test times in seconds. It is not easily readable when the number is big. Can I convert this to minutes by setting some option in command line? Is there any other way to do this?

I am trying to do this without the use of jenkins.

Please share if you know something about this.

Thanks.


Solution

  • What you can do is to use PHPUnit and generate HTML report for test coverage. It's similar to junit log:

    phpunit --log-junit results/phpunit/junit.xml --coverage-html=results/phpunit/covegare -c tests/phpunit.xml

    Then you can use Jenkins - Post-build Actions

    • Publish Junit test result report
    • Publish HTML reports

    This way you will have tests results but also very useful code coverage report.