Valentina
Valentina

Reputation: 644

Cucumber-js 3.x: how get scenario name in Before hook?

I use Cucumber 3.x and I want get scenario name in Before hook. My code seems like this:

Before(function (scenario) {
        let name = scenario.name;
         console.log(scenario) //debug printing

        return require("./driver").createDriver(desired);
    });

And console.log in Cucumber 3.x shows only this:

{ sourceLocation:
   { uri: 'name_my_feature.feature',
     line: 206 } } //206 - is line current scenario name

How I can get scenario name?

Upvotes: 1

Views: 2070

Answers (1)

Coding Edgar
Coding Edgar

Reputation: 1475

I found it under scenario.pickle.name

Upvotes: 3

Related Questions