Jenkins has great support for taking JUnit-style test reports and tracking successes and failures.
Saucelabs has an extension for running parallel tests, but only reports a total pass/fail with aggregated PHPUnit output. This doesn’t help Jenkins since it needs the XML to properly report.
I noticed Jenkins will also take multiple XML results and combine them into a test report. So, I figured that if we made each parallel process generate an XML, we could just get Jenkins to combine them until this functionality gets built into PHPUnit.
And it worked! Let’s modify vendor/bin/paraunit
Change
$cmd = "$PHPUNIT --filter=$testName $testFile";
to
$cmd = "$PHPUNIT --log-junit result-$testName.xml --filter=$testName $testFile";
Then, in Jenkins, add a new “Publish JUnit report” and add all your XML files as a result (e.g., “result-*.xml”)
Make sure to delete the XML results before each test run!
This brings back the reporting functionality that you get running plain PHPUnit with –log-junit 🙂