When a scenario is subject to random intermittent failures, and the steps can tell when that's happened, it would be useful if the step can communicate to cucumber that the scenario just needs to be skipped.
The use case is where the scenario depends on infrastructure (e.g. network latency) that might come and go. A simple FAIL doesn't enable you to distinguish between defects in the code, and environmental / infrastructure issues.
The implementation of this should be as simple as adding a new type of Exception (like Undefined or Pending) that allows you to cause Cucumber to skip the scenario.
I was wondering if we could have something like this too.
Our use case is slightly different - we want to indicate that a certain scenario is irrelevant for the configuration of the software being tested (which is figured out by app configuration methods which examine configuration files and environment variables etc. so not easily done using tags). Undefined would probably cover this.
Alternately we could have a separate hook that lets us tell cucumber not to run the scenario, but that wouldn't cover the use cases you mention above.
We have a similar use case. Certain tests are irrelevant depending on the configuration of the software. And because there are hundreds of wildly different configurations in the wild it's not easy to handle with tags. Ideally we would like for cucumber to be able to skip a test based on a specific condition. For example, if a certain button doesn't exist on a certain page, just skip the next 3 tests.
If one of you who is interested in this feature could rustle up a PR with a failing scenario that describes the behaviour you want, I'll do my best to get this into the 2.0 release.
Allow a step to skip the scenario
cc @tom025 this can be used for dry-run also