Integrating Eclipse with Cucumber-Natural Plugin

In this blog, we will understand how to integrate Eclipse with Cucumber-Natural plugin.

During my analysis for most of the teams that i have mentored and coached, I have noticed that only some of the team members are using Gherkin specific plugin to write feature files. we can use Cucumber/Gherkin Specific plugins in order to write Feature files efficiently and quickly.  Let the plugin take care of formatting and everything else and let us focus on the Business scenarios.

Cucumber-Natural plugin which is very useful for writing feature files.

Steps to Integrate Eclipse-Cucumber-Natural plugin:

1) Open Eclipse, Click Help -> Eclipse Market Place

Screen Shot 2016-04-28 at 11.42.54 am

2) Type ‘cucumber’ in ‘Find’ and click on Install

Screen Shot 2016-04-28 at 11.43.26 am

3) Select ‘Cucumber Editor’ and click continue.

Screen Shot 2016-04-28 at 11.43.48 am

4) Follow through the prompts.

5) Once all the Steps are complete, eclipse will restart.

6) Open the project explorer, and if you see feature files with symbol as in screenshot, then implementation is successful.

Screen Shot 2016-04-28 at 11.55.05 am

 

Benefits of using Cucumber-Natural Plugin

Syntax Highlighting: Syntax highlighting is very important When creating feature files. If we are writing a keyword and it has not been highlighted in-correct color that means, we are spelling/formatting the keyword properly.

Screen Shot 2016-04-28 at 12.18.51 pm

Please note that the syntax highlighting is completely customizable through Window > Preferences > Cucumber > Syntax Coloring

Screen Shot 2016-04-28 at 12.20.29 pm

 

 

Auto completion: Every person has his own style of writing, they can represent a Step in multiple ways Like ‘user should be on home page’, ‘user is on home page’, ‘user is redirected to home page’. This could lead to lot of redundant steps, losing the objectivity. Natural plugin allows you to see all already existing steps starting with a particular word. so you can see which all steps have been defined and use them accordingly.

Type CTRL-space and you will be prompted with a list of grammar valid options or with a code template (look at the code templates feature for more details).

Screen Shot 2016-04-28 at 12.22.52 pm

 

 

Outline navigation: Your files are becoming complex and long? No worries, use the outline view on your right to quickly find what you are looking for.

Screen Shot 2016-04-28 at 12.26.44 pm

 

 

Step definition validation: while you are editing your feature files a warning will be created if no definition can be found for a step or multiple matching definitions can be found! No more runtime behavior due to multiple matches.

Screen Shot 2016-04-28 at 12.30.05 pm

Screen Shot 2016-04-28 at 12.31.17 pm

 

 

Code templates: It works as part of the code completion but it’s user customizable: just open your plugin preferences (Window > Preferences > Cucumber > Templates) and start messing with the default ones!

Screen Shot 2016-04-28 at 12.29.11 pm

Screen Shot 2016-04-28 at 12.29.18 pm

 

Source formatting: just hit CTRL + SHIFT + F to have your source code pretty formatted.

Advertisements

2 thoughts on “Integrating Eclipse with Cucumber-Natural Plugin

  1. How can I add already defined steps on the feature file..
    My feature files already have definitions.. but with the Natural plugin How can I can i add the sources where the definitions are supposed to be searched from..

    Like

    • I guess Natural plugin should use the RunCukeTest class to find the location of StepDefinitions, so try putting the already defined Stepdefinition in the package that has been marked for StepDefinitions and Natural plugin should pick it up. You may need to refresh/close-open the project in eclipse or restart eclipse. Let me know if it works.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s