如何在 Eclipse 中配置 Cucumber 特性文件?

How to configure Cucumber feature file in Eclipse?

我有一个功能文件如下:

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

但问题是它显示为普通文件,根本没有小黄瓜颜色,我也看不到 find step 选项,当我右击一个步骤时。

我找到了答案:

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.

请按照以下步骤操作

-右击 。功能文件 -> 打开方式 -> Cucumber 编辑器

我也在寻找解决方案。在网上找不到任何东西。所以我一直在寻找 eclipse 编辑器并找到了这个。

  1. Window -> 首选项
  2. 在左侧首选项 window 单击常规 -> 编辑器 -> 文件关联
  3. 在右侧单击添加... 在文本框中输入 *.feature 然后单击确定
  4. Select列表中新增的*.feature
  5. 在关联的编辑器下单击添加...,然后选择带有绿色黄瓜图标的编辑器。点击确定
  6. 申请并关闭