Running PHPUnit tests for a Flow package

(Corentin Badot-Bertrand) #1

Hi guys,

I am currently developing a Flow package and would like to test it using PHPUnit. I wrote some a basic test for one of my models in the Tests directory of my package.

The problem occurred when I tried to run PHPUnit with the test directory as argument, I got the following error:

Class ‘TYPO3\Flow\Tests\UnitTestCase’ not found

Since the official Flow documentation doesn’t have a manual for testing (, I made a lot of research but could not find some instructions.

Do some of you perhaps already have some experience with running tests for a flow package?

Thanks a lot,

(Philipp Bucher) #2

Install the BuildEssentials from
The package contains a UnitTests.xml config file which includes some config values and a bootstrap file.
Go into Build/PhpUnit and run phpunit -c UnitTests.xml for unit tests and phpunit -c FunctionalTests.xml for the functional tests. The config implements an “All Tests” test suit.

<testsuite name="All tests">

(Corentin Badot-Bertrand) #3

Thanks a lot for your answer! My unit tests are now running smoothly… :smile:

(oliver russell) #4

Check if you have written the test case correctly or not. To run PHP unit testing, you need to first set your directory structure after installing the tool. Check this guide on php unit testing on how you can organize the directory structure.