How to configure Cucumber feature file in Eclipse?

6.8k views Asked by At

I have a feature file as below:

Feature: Log in to the application

@OnlyOneTime
  Scenario: Login to application as valid user
    When User enter the valid credentials
    And Click on Login
    Then Home Page should be displayed

  Scenario: Login to application as Invalid user
    When User enter the inValid credentials
    And Click on Login
    Then Error Message Should be displayed

But the problem is it is being shown as plain file not at all with the gherkin colors, also I can't see find step option when I right click on a step.

enter image description here

3

There are 3 answers

0
Kushal Bhalaik On BEST ANSWER

I found an answer :

When everything is installed right, and if feature file does not display the gherkin colors, We need to first create a sample cucumber.feature file in the same path.

Once this is created if it is auto-populated with sample gherkin code, then other feature file will also work or we can simply paste content of our feature file into cucumber.feature and then rename it.

0
Shailja Pandey On

Please follow the following steps

-Right click on . feature file -> Open With -> Cucumber Editor

0
NineLDev On

I was also looking for a solution to this. Can't find anything on the web. So I keep looking on eclipse editor and found this.

  1. Window -> Preferences
  2. On the left side Preferences window click General -> Editors -> File Associations
  3. on the right side click Add... Enter *.feature on the textbox then click OK
  4. Select the newly added *.feature on the list
  5. Under Associated editors click Add... then choose the Editor with the green cucumber icon. click okay
  6. Apply and Close