Versions Compared

Key

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

...

Resolve from step in Gherkin file to Context file

Hover step in Gherkin file with Ctrl (Cmd on Mac OS) 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 (Cmd-B on Mac OS) with an editor caret placed at the step in Gherkin file. Image Added

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

Image Added

Find Usages from Context file to usages in Gherkin files

From any Context file you can find all the usages of this 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: Image Added

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. Image Added

Generation for undefined steps

If any of steps in you *.feature file are undefined, the PhpStorm will spot that in a moment highlighting step in question: Image Added

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

You will be immediately offered to choose step definition file from your project or create a new one.

Image Added

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

Image Added

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

Image Added

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

Image Added

As soon as you are done with these options, a new step definition file will be created:

Image Added

Make sure to report any bugs and feature requests related to Behat functionality to the Issue Tracker.

Align
alignright

HTML
<a href="http://twitter.com/share" class="twitter-share-button" data-text="Using Behat in PhpStorm" data-count="horizontal" data-via="phpstorm" data-hashtags="">Tweet</a><script charset="local" type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<span id="fb-root"></span><script charset="local" type="text/javascript" src="http://connect.facebook.net/en_US/all.js#appId=225642620794980&xfbml=1"></script><fb:like href="http://confluence.jetbrains.com/display/PhpStorm/Using+Behat+in+PhpStorm" send="false" layout="button_count" width="150" show_faces="false" style="position:relative;margin-left:-20px;top:-5px;"></fb:like>
<script type="text/javascript" src="http://apis.google.com/js/plusone.js"></script>
<g:plusone size="medium"></g:plusone>