Feature files discovery in cucumber-junit-platform-engine(cucumber-junit-platform-engine 中的功能文件发现)
问题描述
在 cucumber-junit
库中,我使用 @CucumberOptions
来定义功能文件位置:
In cucumber-junit
library I use @CucumberOptions
to define feature files location:
我正在使用自定义 gradle 任务 cucumberTest
I'm running my tests with custom gradle task cucumberTest
迁移到 cucumber-junit-platform-engine
后,不再支持 @CucumberOptions
.
After migrating to cucumber-junit-platform-engine
@CucumberOptions
are no longer supported.
我可以通过将 plugin
、tags
、glue
选项替换为属性 cucumber.filter.tags
, cucumber.glue
, cucumber.plugin
.
I can make it work with replacing plugin
, tags
, glue
options with properties cucumber.filter.tags
, cucumber.glue
, cucumber.plugin
.
features
属性呢?如果我更改功能文件位置以匹配包名称,即 resources/com/mycompany/cucumber/is_it_friday_yet.feature
,它工作正常.这仍然是一个简单的案例,我还有更多的测试包没有放在与源代码相同的位置,我无法移动它们.
What about features
property? It works fine if I change feature files location to match package name i.e. resources/com/mycompany/cucumber/is_it_friday_yet.feature
. Still this is a simple case and I have many more test packages which are not placed in the same locations as source code and I cannot move them.
推荐答案
Gradle不支持基于非类的测试引擎.但是,您可以创建 自定义任务使用 JUnit Platform ConsoleLauncher.然后,您可以使用 Junit 5 选择器 即 支持 Cucumber 选择您的功能.例如 FileSelector
和 --select-file
.
Gradle doesn't support non-class based test engines. However you can create a custom task that uses the JUnit Platform ConsoleLauncher. You can then use the Junit 5 selectors that are supported by Cucumber to select your features. For example the FileSelector
with --select-file
.
这篇关于cucumber-junit-platform-engine 中的功能文件发现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!