Running PHPUnit tests for a Flow package

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,

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">

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


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.

I also have startup problems with Neos Flow and PHPUnitTests. I hope it’s ok to reopen this old thread.

I’m using Neos Flow 6.3.0. PHPUnit is installed: “phpunit/phpunit”: “~8.1”,

I placed in “My.Package/Tests/Unit” a StringServiceTest class.

The xml file is in “Build/BuildEssentials/PhpUnit/UnitTests.xml”.

Going to Build/BuildEssentials/PhpUnit/ and run phpunit -c UnitTests.xml will not work: “Command ‘phpunit’ not found”

I think, I missed a very simple step. Can anyone help me out at this point? Thank you very much!

it’s better to start a new one :slight_smile:
otherwise all the original participants get notifications for year old threads.

as for your question: make sure to run phpunit from the bin directory