Cucumber 在 4.7 中已弃用 Given/Then/When - 它们应该被什么取代?
Cucumber has deprecated Given/Then/When in 4.7 - what should they be replaced by?
我最近升级了我的 Cucumber/Java-based 测试工具,将 Cucumber 依赖项从 4.3.1 升级到 4.7.0。现在 Eclipse 报告 Then 标记已弃用。例如,在我的步骤定义 class 中,Eclipse 报告了一个警告,指出 Then is deprecated next to this method:
@Then("Invoke the Functional API")
public void invoke_the_functional_api(DataTable dataTable) {
/* Body of step definition */
}
此步骤定义的主体未引用任何其他步骤定义。通常,当我看到弃用的警告时,我会研究如何用更新的代码替换弃用的用法,但我无法弄清楚在这种情况下会发生什么。有人知道吗?
标签本身并未弃用。导入是。您需要将导入语句更新为新的导入。
”
已弃用 classes 的迁移信息(截至 cucumber-jvm v4.5.x):
进口io.cucumber.junit.CucumberOptions
进口io.cucumber.junit.Cucumber
您可以将 java8 lambda 导入替换为 io.cucumber。java8.En
和 java 与 io.cucumber.java.en.Given
如果您 运行 通过 IDEA 更改 运行 配置中的主要 class:io.cucumber.core.cli.Main."
Link 在 Cucumber 文档中发布:https://github.com/cucumber/docs.cucumber.io/issues/142#issuecomment-508719509
The body of this step definition does not reference any other step definitions. Normally, when I see a deprecated warning, I would investigate how to replace the deprecated usage with more up-to-date code, but I can't work out what that would be in this case. Does anyone know?
在您的 IDE 中,您可以使用 ctrl + Click
或 fn + Click
进入元素的源代码。然后,您的 IDE 通常还会询问您是否要下载源代码。你应该做这个。源代码中的 Javadoc 会告诉您建议 class 迁移到什么地方。
谢谢..
导入io.cucumber.java.en.*;
当我导入上面的行时,我的错误消失了。
我最近升级了我的 Cucumber/Java-based 测试工具,将 Cucumber 依赖项从 4.3.1 升级到 4.7.0。现在 Eclipse 报告 Then 标记已弃用。例如,在我的步骤定义 class 中,Eclipse 报告了一个警告,指出 Then is deprecated next to this method:
@Then("Invoke the Functional API")
public void invoke_the_functional_api(DataTable dataTable) {
/* Body of step definition */
}
此步骤定义的主体未引用任何其他步骤定义。通常,当我看到弃用的警告时,我会研究如何用更新的代码替换弃用的用法,但我无法弄清楚在这种情况下会发生什么。有人知道吗?
标签本身并未弃用。导入是。您需要将导入语句更新为新的导入。
” 已弃用 classes 的迁移信息(截至 cucumber-jvm v4.5.x):
进口io.cucumber.junit.CucumberOptions
进口io.cucumber.junit.Cucumber
您可以将 java8 lambda 导入替换为 io.cucumber。java8.En
和 java 与 io.cucumber.java.en.Given
如果您 运行 通过 IDEA 更改 运行 配置中的主要 class:io.cucumber.core.cli.Main."
Link 在 Cucumber 文档中发布:https://github.com/cucumber/docs.cucumber.io/issues/142#issuecomment-508719509
The body of this step definition does not reference any other step definitions. Normally, when I see a deprecated warning, I would investigate how to replace the deprecated usage with more up-to-date code, but I can't work out what that would be in this case. Does anyone know?
在您的 IDE 中,您可以使用 ctrl + Click
或 fn + Click
进入元素的源代码。然后,您的 IDE 通常还会询问您是否要下载源代码。你应该做这个。源代码中的 Javadoc 会告诉您建议 class 迁移到什么地方。
谢谢..
导入io.cucumber.java.en.*;
当我导入上面的行时,我的错误消失了。