Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


You can either download behat.phar package from Behat GitHub repository manually, or automatically install it in from Settings | PHP | Behat | Download behat.phar from...


Behat run configurations can be set in the same way as PHPUnit’s. Usual testing workflow (running with Run run action, UI for running tests and displaying results) is supported.


4. If you haven't configured path to Behat directory or behat.phar file before, PhpStorm will offer you to do so with a Fix button in the run configuration dialog. Provide path to Behat and default configuration file (if needed).


Behat configuration can be always changes changed in Settings | PHP | Behat.

Alternatively, you can use Behat via Remote Interpreter, configuration is similar with the only difference that you should have remote PHP interpreter configured.


Apart from standard workflow which involves providing paths to test scenarios manually, you can invoke context action Create Run Configuration | Folder name (with Behat icon) _or  or create and run it straight away with _with Run | Folder name (with Behat icon) for folders in Project Tool Window:

Same actions are available in Run | Run menu (Alt + Shift + F10 / Ctrl - Alt - R):


It works in the same way for context action inside *.feature file in the editor (creating run configuration or running all scenarios from file or single scenario from file):


As stated earlier, usual testing workflow (running with Run run action, UI for running tests and displaying results) is supported similar to the one for PHPUnit.

That means that as soon as the run configuration is created (or you are running test scenarios for folder/file from the context menu action), your tests will be run and the results will be displayed in the test runner tab:


From the test runner tab you can navigate to source of the test, sort or sort/ filter /etc results of tests, and much more.

Behat Intellisense

Resolve from step in Gherkin file to Context file

Hover step in Gherkin file with Ctrl (Cmd on Mac OS) hotkey Ctrl / Cmd hotkey pressed and get relevant method from the Context file highlighted. Clicking on appeared link immediately navigates you to the declaration. You can also navigate to the method declaration in the Context file with Ctrl+B (CmdB / Cmd-B on Mac OS) with  with an editor caret placed at the step in Gherkin file.

As soon as navigation action is invoked, you are navigated to the very method in Context file (FeatureContext.php in our case):

Find Usages from Context file to usages in Gherkin files

From any Context file you can find all the usages of this the method in all *.feature files. Just place a caret at the method name and invoke Alt-F7 (or context menu action Find Usages). You will see all the usages of desired method in project files:

Keyword and step completion

All the keywords and steps are completed with a basic code completion action (Ctrl+Space) in *.feature files. All the steps are indexed from current project and always up-to-date.

Generation for undefined steps

If any of steps in you your *.feature file are undefined, the PhpStorm will spot that in a moment highlighting step in question with undefined step reference inspection result:

Press Alt+Enter (or click on the light bulb) to get list of relevant quick fixes, and select the one named Create Step Definition.


In case of choosing already existing step definition file, step definition will be immediately created there with relevant PHPDoc:

In case you would like to create a new file, this option should be selected from the list on the previous step:

Create New Step Definition File dialog will appear providing you an opportunity to set a file name, file type and file location: