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
2) Type ‘cucumber’ in ‘Find’ and click on Install
3) Select ‘Cucumber Editor’ and click continue.
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.
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.
Please note that the syntax highlighting is completely customizable through Window > Preferences > Cucumber > Syntax Coloring
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).
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.
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.
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!
Source formatting: just hit CTRL + SHIFT + F to have your source code pretty formatted.