![](/img/trans.png)
[英]Running Cucumber project using Main.run from another main method
[英]How to generate Cucumber Report using Main.run method?
我正在為 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 { }
如何使用這種方法配置它?
您可以在添加膠水和功能的同一陣列中使用其他選項,如下所示
String[] commonOptions = {
"--glue",
"com.test.automation.stepdefinitions",
"--tags",
"@foo",
"--plugin",
"pretty",
"--plugin",
"html:"+reportFolderPath+"/html",
"--plugin",
"json:"+reportFolderPath+"/cucumber.json",
FEATURE_FILE_PATH
};
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.