goofballLogic
goofballLogic

Reputation: 40489

In cucumber.js, disable a scenario and report it as Pending even if steps are implemented

I want to disable certain scenarios in my Cucumber.js feature files because even though steps are implemented (reused from other scenarios), the code will fail under these circumstances because the feature is not yet implemented.

However, I don't want to use the @ignore tag on these scenarios as they then aren't seen in the output report and the team forget about them.

What's the best way to do this without explicitly adding a dummy "Given this is not yet implemented" step to each of the new scenarios?

Upvotes: 1

Views: 1964

Answers (2)

Ray
Ray

Reputation: 1214

Your above answer is the best way I can see to do it and is actually the way that the cucumber-js team recommend doing so as seen in https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/hooks.md#skipping-in-a-before-hook

They give two available statuses to use from as seen in https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/step_definitions.md#pending-steps

Upvotes: 1

goofballLogic
goofballLogic

Reputation: 40489

Here's one idea I had, but it's not built-in to the framework itself. I'm just exploiting the feature of a Before step which only runs for certain tags

Before({ tags: "@TODO" }, function() {

    return "pending";

});

Not sure if there's a more framework-centric way to do it?

Upvotes: 2

Related Questions