Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

run all zend framework2 unit tests

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?

like image 756
veilig Avatar asked Jul 10 '13 13:07

veilig


1 Answers

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>
like image 62
Aine Avatar answered Nov 15 '22 06:11

Aine