我正在使用Java的Cucumber
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>6.1.1</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>6.1.1</version>
</dependency>
我没有使用Cucumber Options
配置要使用的步骤或功能。我正在使用Main.run
方法
String feature = "/resources/service1/feature1.feature"
Main.run(new String[]{"--glue", "example.aop.testing.steps", feature}
, Thread.currentThread().getContextClassLoader())
一切正常,但是我想生成一个包含结果的报告。我正在阅读并配置它,我需要使用Cucumber Options
,如下所示:
@RunWith(Cucumber.class)
@Cucumber.Options(format = {"pretty", "html:target/cucumber"})
public class runTest { }
如何使用该方法进行配置?
答案 0 :(得分:2)
您可以在添加胶水和功能的同一阵列中使用其他选项,如下所示
String[] commonOptions = {
"--glue",
"com.test.automation.stepdefinitions",
"--tags",
"@foo",
"--plugin",
"pretty",
"--plugin",
"html:"+reportFolderPath+"/html",
"--plugin",
"json:"+reportFolderPath+"/cucumber.json",
FEATURE_FILE_PATH
};