I'm trying to get a project build setup in Jenkins for Zend Framework 2, I want to run all the unit tests for each of the modules I am writing - but I'm a lil unclear how to do this?
Each module has its own 'test' directory and I can run each modules test suite just fine. Do I have to write some script to find all custom modules and run their tests? Does anyone have a good example how to do this?
First, get the test to run together
I would try writing a new phpunit config file, say all.xml, giving the details of the different test files.
<phpunit>
<testsuite name="Module1">
<directory>./module1</directory>
</testsuite>
<testsuite name="Module2">
<directory>./module2</directory>
</testsuite>
<testsuite name="Module2">
<directory>./module3</directory>
</testsuite>
</phpunit>
Test that this runs ok on the command line
$ phpunit -c all.xml
Add to Jenkins
Just add this into you Jenkins config. Here is an example if you use an Ant xml file:
<target name="phpunit" description="Run unit tests with PHPUnit">
<exec executable="phpunit" failonerror="true">
<arg line=" -c tests/all.xml" />
</exec>
</target>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With