繁体   English   中英

Intellij 无法识别 Cucumber 5 groovy 步骤

[英]Intellij not able to identify Cucumber 5 groovy Steps

Intellij Community Edition 2020.1.3 无法识别已在 stepdefinition 中定义的步骤。 我只使用 cucumber-groovy、cucumber-core、cucumber-junit:所有 5.1.3 版本。

我在下面尝试过,但没有用。

  • Cucumber Groovy & Cucumber Java 插件已安装
  • 没有安装 Substeps 插件

我在 github 上引用这个项目: https://github.com/cucumber/cucumber-jvm-groovy/blob/main/examples/src/test/groovy/calc/CalculatorSteps.groovy

我的步骤定义包含如下代码

import io.cucumber.datatable.DataTable
import groovy.transform.Field
import groovyx.net.http.ContentType
import groovyx.net.http.HttpResponseException
import io.cucumber.groovy.EN
import io.cucumber.groovy.Hooks

this.metaClass.mixin(Hooks)
this.metaClass.mixin(EN)

def response
@Field evalResponse
@Field String DATABASENAME_CPGP01 = "011032"
@Field String DATABASENAME_CPGP02 = "011033"
@Field TetrisRESTClient tetrisRESTClient
@Field TetrisRESTClient jobRestClient
JemsTest.enableExtentReporting = false;

Before('@Functionality001') {
    initializeSetUp()
}

Given(/I am on XYZ screen/) { -> }

And(/below are the given inputs/) { DataTable arg1 -> }

我自己想通了。 步骤定义中使用的 Regex 语法是 Java 而不是导致问题的 Groovy。 我忽略了这个微小的差异。

要解决此问题,您应该更新您的库。

如果没有帮助,请通过本教程尝试 go: https://medium.com/@cheparsky/migration-cucumber-older-version-4-to-newer-version-6-133ffb60813d

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM