@CucumberOptions注解:相当于Cucumber的初始化配置
Maven依赖包
<!-- 用户验收测试框架 io.cucumber.junit.CucumberOptions -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>7.8.1</version>
</dependency>
Cucumber提供了以下主要选项:
Options Type (选项类型) | Purpose(用途) | Default Value(默认值) |
dryRun | true:检查所有步骤是否都有步骤(Step Definition)定义 | false |
plugin | 添加插件,可以添加cucumber内置或者第三方插件,比如测试报告插件 | {} |
features(剧本) | set:feature文件的路径 | {} |
glue | set:步骤定义(Step Definition)文件的路径 | {} |
tags | instruct(指示): 指定应该执行features文件中的哪些标签 | {} |
monochrome | True:以可读的方式显示控制台输出 | false |
format | set:What all report formaters to use | false |
strict | true:如果存在未定义或挂起的步骤,则执行将失败。 | false |
sampl
@CucumberOptions(
//publish = true,
//plugin = {"com.cucumber.listener.ExtentCumberFormatter:extent-report/report.html"}, //格式化插件
//plugin ={"pretty", "html:target/html-report.html", "json:target/json-report/run.json","junit:target/cucumber-reports/cucumber.xml"},
plugin ={"pretty","json:target/json-report/run.json"}, // 生成的json文件
//features = {"src\\test\\resources" }, //feature路,
features = {"classpath:features" }, //features路路径,
glue = "com.cacho.s2b.lesson", //步骤所在的包名
monochrome = true, //
tags = "@test" //指定标签,多标签:"标签1 or/and/and not 标签2"
)