Run all zend framework2 unit tests

I am trying to get a Jenkins project build installation for Zend Framework 2, I want to run all unit tests for each of the modules that I write, but I don’t understand how to do this?

Each module has its own β€œtest” directory, and I can run each set of module tests just fine. Do I need to write a script to find all user modules and run their tests? Does anyone have a good example on how to do this?

+6
source share
1 answer

Try a test first

I would try writing a new phpunit configuration file, say all.xml, indicating the details of the various 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> 

Verify that this is running on the command line

 $ phpunit -c all.xml 

Add to Jenkins

Just add this to your Jenkins configuration. Here is an example if you are using 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> 
+2
source

Source: https://habr.com/ru/post/949126/


All Articles