New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can we get Scenario Name in each step of Step-Definition ? #200
Comments
You mean "Scenario: here is the name" - you want to retrieve it when? you can attach custom listener and during BeforeScenario event get scenario payload and on it call getName() |
How do you do that? Because both of these return 'undefined'.
|
Hi Stewart, Have another try with this code: // This code is generated from coffeescript so it appears a bit more verbose than needed
this.registerHandler('BeforeScenario', function (event, callback) {
var scenario = event.getPayloadItem('scenario');
console.info("\n[" + (scenario.getName()) + "](" + (scenario.getUri()) + ":" + (scenario.getLine()) + ")");
callback();
});
this.registerHandler('BeforeStep', function (event, callback) {
var step = event.getPayloadItem('step');
console.info("\n[" + (step.getName()) + "](" + (step.getUri()) + ":" + (step.getLine()) + ")");
callback();
}); The trick is that you need to provide an argument to |
And to answer to your question, you should be able to store the current running scenario properties in an object outside of the BeforeScenario handler, then use it within the BeforeStep handler. |
This is an issue tracker. Please post support questions to the cukes google group instead. |
What is the latest and greatest way to do this now? Getting step names and such? |
Bump |
No description provided.
The text was updated successfully, but these errors were encountered: