Fil*_*ire 1 java intellij-idea cucumber serenity-bdd cucumber-serenity
我有一个 gradle + Serenity + RestAssured 自动检查套件设置,我通常通过 shell 会话中的 gradle 命令运行,但有时我需要使用 IntelliJ 运行单个场景。
当我在 IntelliJ 上运行 Scenarios 时,我通常会收到很多这样的警告:
8312 [main] WARN cucumber.runtime.SerenityBackend - It looks like you are
running a feature using @RunWith(Cucumber.class)
instead of @RunWith(CucumberWithSerenity.class).
Are you sure this is what you meant to do?
Run Code Online (Sandbox Code Playgroud)
我想知道在何处以及如何在 IntelliJ 中配置运行/调试配置,以便运行检查并CucumberWithSerenity.class修复警告。
我正在使用以下依赖项:
serenity-rest-assured:1.9.31
serenity-core:1.9.31
serenity-cucumber:1.9.12
Run Code Online (Sandbox Code Playgroud)
IntelliJ版本2018.1.5(社区版)
以下是 Serenity-BDD 的作者 John Ferguson Smart 博客中的步骤(考虑到您已经安装了Cucumber for Java插件)。
\n\n直接从 IntelliJ 运行带有 Serenity 功能文件的 Cucumber:
\n\n\n\n\nIntelliJ 为 Cucumber 功能文件提供了出色的集成支持。您甚至可以通过右键单击功能文件来运行功能。但是,当您将 Cucumber 与 Serenity 一起使用时,这将不起作用,因为 Serenity 需要在执行之前检测功能文件。幸运的是,这个问题很容易解决。这里\xe2\x80\x99s如何:
\n\n\n
\n\n- 单击要运行的功能文件
\n- 在“运行”菜单中选择“运行\xe2\x80\xa6”
\n- 在上下文菜单中,选择该功能,然后选择 \xe2\x80\x9cEdit\xe2\x80\xa6\xe2\x80\x9d
\n- 您现在应该看到 \xe2\x80\x98Edit Configuration Settings\xe2\x80\x99 窗口。将主类设置为 \xe2\x80\x98net.serenitybdd.cucumber.cli.Main\xe2\x80\x99
\n- 将 Glue 字段更改为项目(或步骤定义)的根包
\n- 单击“应用”
\n现在,您可以通过右键单击功能文件直接运行您的功能。
\n
PS 并非所有版本的 Cucumber for Java 插件都能正常工作,尤其是当您刚刚将 IntelliJ IDEA 更新到最新版本时。我可以确认下一个设置可以正常工作:
\n\n| 归档时间: |
|
| 查看次数: |
7300 次 |
| 最近记录: |