I would like to get name of scenario to have meaningful logs and to generate custom report at run-time in java. Scenario class have only has getStatus() and getSourceTagName
Below is the entire code for the problem asked, to save your time:
import io.cucumber.java.Before;
import io.cucumber.java.Scenario;
Scenario scenario;
@Before
public void before(Scenario scenario) {
this.scenario = scenario;
}
@Given("I test scenario name")
public void test() {
System.out.println(scenario.getName());
}