Skip to content

Using PhpStorm for BDD with Codeception

Since some time Codeception also allows to write tests in Gherkin. This is a great addition to an already great tool.

When you do BDD you would also like to have a nice editor for your scenarios, which allows you to jump between steps and their step definitions, etc. A popular IDE for PHP is PhpStorm. And luckily the integration of Codeception has been announced:


But already now you can use the Gherkin features of the IDE to write your Codeception BDD scenarios:

  1. Install the Behat Support plugin.
  2. Get Behat and make it known to PhpStorm in the Settings: Languages and Frameworks —> PHP —> Behat
  3. Now you can add a new feature file ending with .feature.
  4. It will mark all steps as having an undefined step reference:
  5. If you go to such an undefined step, you can do an Alt-Enter, which offers you to create a step definition:
  6. Doing so creates a new file like this:

    You do not need to create step definitions like this, you can simply use any file if you take care that that file implements the Context interface.
  7. Now PhpStorm knows where the step references are, it looks in all files which implement the Context interface.
  8. In your feature file you can now CTRL-click on the step, and you are jumping to its step definition.
  9. For Codeception you still need to add the step definition file to the suite config.

That’s it!

  • Twitter
  • Bookmark Using PhpStorm for BDD with Codeception at del.icio.us
  • Facebook
  • Google Bookmarks
  • Digg Using PhpStorm for BDD with Codeception
  • Identi.ca

Trackbacks

No Trackbacks

Comments

Display comments as Linear | Threaded

No comments

Add Comment

Gravatar, Twitter author images supported.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.
Form options