Versions Compared

Key

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

...

Redirect

...

alignright

...

locationhttps://

...

www.jetbrains.com/

...

help/

...

phpstorm/using-behat-framework.html
delay2

Include Page
Social Buttons PhpStorm
Social Buttons PhpStorm

 

Note
iconfalse

Behat is a BDD (behavior driven development) framework for PHP. With BDD, you write human-readable stories that describe the behavior of your application. These stories can then be auto-tested against your application. This tutorial describes how to install, configure and use Behat right from the PhpStorm IDE.

Behat support is currently available in PhpStorm 8 EAP.

Table of Contents

Prerequisites

To make use of Behat, we first have to install it on our system. Read more about Behat installation in official documentation.

...

Use the Composer | Add dependency... context menu on in your project and install behat/behat package:

...

3. Provide the path to the directory which that contains test scenarios (/Users/user/PhpStormProjects/Behat/features in our case). Test scope can be defined as a Directory, File, Scenario or Defined in configuration file. There are many additional options which can be configured in this dialog (such as alternative Behat configuration file, test runner options, command line options, or actions to be performed before launch).

...

Depending on your workflow, in order to create run configuration on - the - fly you can just invoke the context action Create Run Configuration | Folder name (with Behat icon) _, or create and run it straight away with _Run | Folder name (with Behat icon) for folders in Project Tool Window:

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

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

...

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

...

Press Alt+Enter (or click the light bulb) to get a list of relevant quick-fixes, then select Create Step Definition. You will be prompted to choose the step definition file from your project or create a new one.:

If you choose an existing step definition file, step definition will be immediately created there with a relevant PHPDoc:

...

After as you have set these options, a new step definition file will be created:

Your input is welcome

If you have any bugs to report and/or feature requests to add related to Behat functionality, please do so in our Issue Tracker.

...

Include Page

...

alignright

...

Social Buttons PhpStorm
Social Buttons PhpStorm