One of my actual goals is to integrate code coverage testing into Jenkins. You know, nice plots for the executive management and so on. ;)

The maintainer of Xdebug and PHPUnit, Sebastian Bergmann, created a dedicated site for Jenkins jobs for PHP projects:
http://jenkins-php.org/

I'd guess we simply have to produce some output that's compatible with the Clover plugin. Needs investigation.

CommentFileSizeAuthor
#4 clover.drush_.inc_.txt2.87 KBericduran

Comments

ericduran’s picture

Hmm, I'm looking to do the same thing. I already have Jenkins managing all the test. Now I just need to figure out how to get the test coverage percent.

ericduran’s picture

Ah, I finally got this working with Jenkins.

I ended up writing my own wrapper around the drush test-run command to run the test and used php-code-coverage (https://github.com/sebastianbergmann/php-code-coverage) to generate the Clover reports.

Sadly I had to give php over 1gb of memory in order to get it working right.

PawelR’s picture

Hi Eric, I'm setting up something similar from scratch, for now I have only Jenkins with automatic deployment using GIT. I would like to add tests and code coverage as well. Could you please post more details about your solution? Are you using Apache Ant?

ericduran’s picture

StatusFileSize
new2.87 KB

Hey PawerIR,

I just saw this.

I'm not using ant. I just run a bunch of shell scripts.

On our actual production enviroment we're not using my clover wrapper because it takes a serious amount of memory to generate the report over 1gb and it slows the test down a lot. But it great for a single testRun.

Here's what we do in one of our enviroment

# Install
drush si my_profile_name -y
/usr/bin/php scripts/run-tests.sh --php /usr/bin/php --url http://www.examples.com/--xml ../test-results TEST_TO_RUN

#RUN phpcs
phpcs --standard="DrupalCodingStandard" --report="checkstyle" docroot/sites/all/modules/custom/ > ../other-results/checkstyle-results.xml

#RUN JSHINT
find docroot/sites/all/modules/custom/ -type f -name *.js -not \( -name *.min.js \) -exec jshint {} --jslint-reporter > ../other-results/jshint-results.xml \; 

So we use that to generate the test results, the checkstyle reports, and the JSHint reports.

I've also attached the drush-wrapper for clover. Is pretty hacky I just whipped it up in a couple of minutes to test it out, but it really takes up A LOT of memory, over 1gb.

To run the drush command do drush clover-test-run --uri=http://examples.com/ --out=/tmp/my-clover-report.xml.

PawelR’s picture

that's very helpful, thanks