带有 IntelliJ 的黄瓜找不到步骤定义

Cucumber with IntelliJ not finding step definitions

我遇到了以下问题。我在 IntelliJ 中有四个 Cucumber 功能文件。我通过 IntelliJ 插件添加了 Cucumber 支持。创建我的功能后,我编辑了我的配置,这样我就可以执行功能文件了。

Glue 应该是步骤定义所在的包的名称。在我的例子中,包称为 stepdefinitions

下图显示了我的项目结构。特征文件位于 /src/test/resource/features 中,而步骤定义存储在 /src/test/java/stepdefinitions 中。

可悲的是,当我尝试 运行 带有步骤定义的黄瓜功能时,我收到提示 "You can implement missing steps with the snippets below:" 但我已经这样做了。我已经将这些片段复制到步骤定义文件中。当我悬停一个场景时,IntelliJ 会告诉我*未实现的子步骤定义。

这两件事让我得出结论,IntelliJ 找不到我的步骤定义。也许你们中有人知道我做错了什么。

我终于找到了问题的答案。该错误是由名为 Substep IntelliJ Plugin 的插件引起的。您需要在 IntelliJ 插件部分搜索它并禁用或卸载它。

禁用 Cucumber 插件以避免特征文件关联冲突,安装 Substeps 插件。参见 http://substeps.github.io/ for more docs on how to use the Substeps BDD framework alongside downloading a sample starter project from here: https://github.com/Substeps/substeps-example/archive/1.1.zip