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 getSourceTagNames() methods. I don't find a way to get scenario name.
Can someone help me to get this resolved ?
Once you have the @Before set up them try this to retrieve your Cucumber Feature and Scenario items.
In addition to,
getStatus()
andgetSourceTagNames()
, there is another method,getName()
that returns the scenario's description. For example, for a scenario as follows:scenario.getName()
returns"verify number of topics shown in the UI"
I initialize scenario in @Before as follows:
Hope this helps.