我需要通过命令行运行特定方案!带标签!我该怎么办?
答案 0 :(得分:2)
您可以借助标签来实现。为该特定情况定义标签,然后可以运行。
EX:
gradle --daemon -D"cucumber.filter.tags=@testscenario1" build --info
答案 1 :(得分:0)
您可以通过在功能文件中指定方案的行号来从功能运行单个方案。
cucumber path/to/feature/foo.feature#xx
其中xx是方案中的行号。
您可以通过运行cucumber --help
如果您使用Java,则根据运行黄瓜的方式,事情可能会有所不同。也许mvn test -Dcucumber.options=”feature file path” + “line number of the scenario”
可能有效(从谷歌搜索run cucumber java from command line
和第一个结果https://www.toolsqa.com/selenium-cucumber-framework/run-cucumber-test-from-command-line-terminal/获得)
注意:我不使用Java,所以我的部分答案可能用处不大
答案 2 :(得分:0)
添加到build.gradle
插件
id "se.thinkcode.cucumber-runner" version "0.0.8"
配置
cucumberRuntime {
extendsFrom testImplementation
}
任务
cucumber {
glue = 'classpath:com.ingenico.component.tests.cucumber'
main = 'io.cucumber.core.cli.Main'
featurePath = 'src/test/resources/features'
}
命令
gradle cucumber --tags @tag
我在https://github.com/tsundberg/gradle-cucumber-runner中得到了这段代码