The Cucumber plugin is an Eclipse plugin that allows the eclipse to understand the Gherkin syntax. When we are working with cucumber we will write the feature files that contain Feature, Scenario, Given, When, Then, And, But, Tags, Scenario Outline, and Examples. By default, eclipse doesn’t understand these keywords, so it doesn’t show any syntax highlighter. Cucumber Eclipse Plugin highlights the keywords present in Feature File.
When we create a feature file in Eclipse it looks something like the below without Cucumber Eclipse Plugin installed.
It is easy to install Cucumber Eclipse Plugin, as it comes as a plugin for Eclipse IDE. A prerequisite for installing this plugin is your Internet connection should be up & running during the installation of this plugin and Eclipse IDE should be installed on your computer.
Steps to follow:
- Launch the Eclipse IDE and, from the Help menu, click “Install New Software”.
2. You will see a dialog window, click the “Add” button.
3. Type the name as you wish, let’s take “Cucumber” and type “https://cucumber.github.io/cucumber-eclipse-update-site-snapshot” as the location. Click the OK button.
4. You come back to the previous window, but this time you must see the Cucumber Eclipse Plugin option in the available software list. Just check the box and press the “Next” button.
5. Click on the Next Button.
6. Click “I accept the terms of the license agreement” and then click the Finish button.
7. You may or may not encounter a Security warning, if in case you do just click the OK button.
8. You are all done now, just click “Restart Now” button.
After restarting the eclipse, you can see the feature file is highlighted based on the keywords.
This means now the eclipse is able to understand the language we have written in the feature file as gherkin language.
All the steps in the below scenario are highlighted in yellow colour, which indicates we don’t have any corresponding step definition for each step.
Now, in the below example, I have created the step definition for the Given statement. So, now, it is not highlighted in yellow colour.
If you press Ctrl button and place the cursor on Given Statement, it will take you to the corresponding step definition of that step. This is a very helpful feature. When we have multiple feature files with multiple steps, it helps us find the exact location of the step definition.
I hope this tutorial makes your learning a little easy. Thanks. Happy Learning!!