I want to get some statistics of how many times each step is used in cucumber test
So lets say I have a step definition like
this.When(/^"([^"]*)" is clicked$/, function (someElementId, callback){});
And 2 usages of this step (in one or more feature files)
"a" is clicked
"b" is clicked
I want to know that this step "([^"]*)" is clicked
was used twice and get the times each execution took. I want to do it dynamically without touching actual step definitions.
I can get the step name like "a" was clicked
in after step event, but I can't get a regexp. Ideally I would like to get smth like step.getRegexp()
:
this.AfterStep(function (step, callback) {
console.log(step.getName())// => prints "a" was clicked
//need smth like step.getRegexp() to make "a" and "b" click identified as the same step
}
You could use the same regex to match the step's name.