如何将场景名称或功能名称作为报告文件名嵌入黄瓜扩展报告中?
How to embed scenario name or feature name as a report file name in cucumber extend reporting?
我正在使用 Cucumber-Extent 报告生成测试执行报告。因为我动态地将名称传递给报告文件。我能够在 runner class 的@before 中传递一个时间戳作为范围报告文件名。但我需要将场景名称或功能名称与时间戳一起传递。给我一个在 runner class 中获取场景名称并将其附加到范围报告名称的想法。
@CucumberOptions( features = "classpath:features",
tags = {"@InsuredInfoScreenAddressValidation"},
glue="classpath:stepDefinition",
plugin = "com.cucumber.listener.ExtentCucumberFormatter:",
"pretty",
"html:target/cucumber-html-report"},
monochrome=true //tags = "@Sample" //tags = "@Testing" )
您可以从 @Before
挂钩中的 Scenario
对象中获取功能文件中提到的场景的名称:
@Before()
public void beforeScenario(Scenario scenario)
{
extent = new ExtentReports (userDir + \test-output\" + scenario.getName()+ ".html", true);
}
我正在使用 Cucumber-Extent 报告生成测试执行报告。因为我动态地将名称传递给报告文件。我能够在 runner class 的@before 中传递一个时间戳作为范围报告文件名。但我需要将场景名称或功能名称与时间戳一起传递。给我一个在 runner class 中获取场景名称并将其附加到范围报告名称的想法。
@CucumberOptions( features = "classpath:features",
tags = {"@InsuredInfoScreenAddressValidation"},
glue="classpath:stepDefinition",
plugin = "com.cucumber.listener.ExtentCucumberFormatter:",
"pretty",
"html:target/cucumber-html-report"},
monochrome=true //tags = "@Sample" //tags = "@Testing" )
您可以从 @Before
挂钩中的 Scenario
对象中获取功能文件中提到的场景的名称:
@Before()
public void beforeScenario(Scenario scenario)
{
extent = new ExtentReports (userDir + \test-output\" + scenario.getName()+ ".html", true);
}