I am using Cucumber-Extent reporting to generate reports for the test execution. In that I am dynamically passing name to the report file. I am able to pass a timestamp as extent report file name in @before of runner class. But I need to pass the scenario name or feature name along with the timestamp. Give me an idea to get the scenario name in runner class and append it to extent report name.
@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" )
You can get the name of the Scenario mentioned in the feature file from Scenario
object in the @Before
hook:
@Before()
public void beforeScenario(Scenario scenario)
{
extent = new ExtentReports (userDir + \\test-output\\" + scenario.getName()+ ".html", true);
}