Functional Testing Frontend-Login

Hi there…

I’m new to Unit-Testing and want to test if the frontend-login of my FLOW Application is working. Assuming this is more a functional test, I started to think about the requirements of testing such a case. Creating a new user in the database, log in, check response, log out, delete user, etc.
Unfortunately the Testing-Section of the documentation is not written (
Can someone help me out with the more FLOW-related stuff? I’m pretty sure, there are some predefined classes and tools inside FLOW wich makes things easier.

Common questions so far…

  • Different database for functional testing?
  • How to make a request?
  • How to check the response?

Any kind of help welcome (youtube-links, doc-links). I’m not shy to read and watch. :wink:

Thanks in advance.

Hey! Glad you want to take a look into testing your application. Unfortunately, testing is (IMO) one of the least documented and/or polished things in the whole framework, but here are a couple of things you can do to get into the topic:

  • Always extend the FunctionalTestCase or UnitTestCase classes for your test case classes, they come with convenience helper methods for Flow
  • In Testing context, flow will by default work with an SQLite in-memory backend for persistence (as specified in Flow Testing Configuration Settings.yaml)
  • You can make requests in Testing via the Browser client Neos\Flow\Http\Client\Browser. In FunctionalTestCase this is already instanciated as $this->browser
  • The response you receive from the browser is a normal Flow Http Response which you can inspect for status code, return body and headers.
  • Also, for convenience on testing expectations on the result body or working with HTML forms, the browser provides a Symfony DomCrawler via ->getCrawler(), which allows you to skim through the result HTML via X-Path (see
  • to run your functional tests, execute bin/phpunit -c Build/BuildEssentials/PhpUnit/FunctionalTests.xml from your flow root directory (you can also filter to only execute the test suite you want by specifying it as additional parameter)

For working tests and some examples on how to test your application, you can for example take a look at the functional Mvc\ActionControllerTest and for the authentication related stuff, take a look at the functional Security\AuthenticationTest inside the Flow Tests folder.

Hope this helps for a start. If you have further questions, just ask!

Good luck!


Hi Alexander

Thank you very much for your short introduction. You helped a lot to get started! :smiley: There are some questions but they’re more or less bound to the IDE (PhpStorm) or the Docker-Setup I use.

One thing wich I couldn’t figure out is the context which my tests are running.

Any Unit-Test I’ve run so far, was working well. But when I run my Functional-Tests I’ve got the this message:

The context “Development/Beach/Instance” is not allowed. Only “Testing” context or one of its subcontexts “Testing/*” is allowed.

I understand the meaning of this, as there is need for a bootstrap of the whole framework. But how could I setup my tests to run in a Testing-Context? This also happens for the tests in the Flow-Framework…

Hi Cornel

You can switch the context with the environment variable FLOW_CONTEXT:

But maybe it’s Beach related here.

Hi Stefan

Yes. Its a combination of IDE and Beach. In my IDE I can’t set the environment variable for the php (that one for the unit test). It would be possible on the CLI …

Actually I’m thinking about, having a different subdomain for testing with a Testing-Context. :thinking:

There is a new feature-request for the beach development environment. Thanks, @robert.