- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在开发一个桌面应用程序,它将执行自动化测试用例。用户可以从 GUI 选择执行类型:按功能/按场景/按标签名称。现在我使用 maven 并在 CMD 中执行命令来执行测试用例,我想切换到 TestNG 执行,但我需要从配置文件动态设置 CucumberOptions,
@CucumberOptions(features = { "src/test/resources/features/" }, tags = { "@Test3" }, glue = { "stepdefinitions" }, plugin = { "listeners.ExtentCucumberFormatter:" })
public class TestNGRunner extends AbstractTestNGCucumberTests {
}
但是 CucumberOptions 需要一个常量表达式,我无法设置它们。
有什么办法可以做到吗?
最佳答案
您可以通过命令行参数传递 Cucumber 选项:
You can list the options available for the Cucumber version you are using.
Pass the --help option to print out all the available configuration options:
java cucumber.api.cli.Main --help
Or:
mvn test -Dcucumber.options="--help"
You can also use tags to specify what to run.
Configuration options can also be overridden and passed to any of the runners via the cucumber.options Java system property.
For example, if you are using Maven and want to run a subset of scenarios tagged with @smoke:
mvn test -Dcucumber.options="--tags @smoke"
provide additional mechanisms for passing options to Cucumber.Some of the runners
关于java - 如何在 Java 中动态设置 CucumberOptions,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56025493/
我是一名优秀的程序员,十分优秀!