- 1 @CucumberOptions ( features = "src/test/resources",
- 2 glue = {"Steps"},
- 3 tags = {"@smokeTest"},
4 plugin = {"pretty", "html:target/cucumber-report", "json:target/cucumber-report/cucumber.json"} )
5 public class CucumberStart extends AbstractTestNGCucumberTests { }
- @CucumberOptions中的features,用于指定我们项目中要运行的feature的目录
- @CucumberOptions中的format,用于指定我们项目中要运行时生成的报告,并指定之后可以在target目录中找到对应的测试报告
- @CucumberOptions中的glue,用于指定项目运行时查找实现step定义文件的目录几点
@CucumberOptions中的tags,用来决定想要Cucumber执行哪个特定标签(以及场景),标签以“@”开头
在实际项目中,一个测试工程可能由多个feature文件组成,并且每个feature文件中可能也是由多个scenario组成。默认情况下,每次运行是运行所有feature中的所有scenario。这样可能导致正常情况下运行一次测试脚本,需要非常长的时间来等待测试结果。
但实际过程中,测试用例是有优先级等区分的,比如smokeTest(冒烟)、regressionTest(回归)等
Tags的标记规则: