0

I have a step which looks like so:

this.When(/^I send a (get|put|post|delete) request to (.*) with payload$/, function(requestType, route, callback) {...});

I have stuff which uses it like so:

And I send a post request to users/password/change with payload

For some reason the code inside the step is never run. I have hollowed it out and just put a console log and then callback and it never gets output. The step before does not error and returns fine so I am baffled as to why this one step seems to never execute, but is flagged on the runner as succeeding, then just skipping all subsequent steps.

So has anyone seen anything like this before or know a way to debug to find out whats going on? I have tried catching unhandled exceptions and outputting them and nothing seems to be kicking off from there. Have tried putting dummy steps before it and that doesn't change it.

I am using 0.9.2 cucumber, 0.12 nodeJS, and am running via the webstorm cucumber runner, although I get same results on the normal CLI runner.

Grofit
  • 17,693
  • 24
  • 96
  • 176

1 Answers1

0

I am not sure if this will help everyone but for some reason this issue is down to ambiguous matches which never seemed to be an issue, I am not sure if the rules changed in some version but I had the following error when running it with a different formatter.

The following steps have multiple matching definitions:

"I send a post request to users/password/change with payload" matches:
/^I send a (get|put|post|delete) request to (.*)$/              # features\step_definitions\shared-step-definitions.js:99
/^I send a (get|put|post|delete) request to (.*) with payload$/ # features\step_definitions\shared-step-definitions.js:126

I changed this to be:

The following steps have multiple matching definitions:

/^I send a (get|put|post|delete) request to (.*)$/
/^I send a (get|put|post|delete) request with payload to (.*)$/

All works fine, although it used to work fine anyway, hope this helps someone else.

Grofit
  • 17,693
  • 24
  • 96
  • 176