There is a skip_this_scenario
function in Ruby version.
Is it able to skip scenario imperatively in JavaScript version?
No that is not currently available. Can you point me to the cucumber-ruby documentation or give an example of the use case?
https://relishapp.com/cucumber/cucumber/docs/defining-steps/skip-scenario
Since cucumber does not support IF/ELSE, so it is useful to list all possible scenarios, and make those GIVEN
condition not fulfilled to be skipped.
Since cucumber does not support IF/ELSE
I don't understand this. How does cucumber does not support IF/ELSE?
so it is useful to list all possible scenarios
Could --dry-run
help with that?
and make those GIVEN condition not fulfilled to be skipped
I'd suggest just making the Given step "pending" and then the rest of the scenario will still be skipped.
@charlierudolph the use case I heard was where a piece of necessary test infrastructure was not available - something you could only discover at runtime - so it made no sense to run that scenario.
I think it was someone testing physical (medical?) devices IIRC.
@charlierudolph I mean there is no IF/ELSE
syntax in cucumber.
--dry-run
does not help here, just like @mattwynne mentioned, some situations would only be discovered at runtime.
And thanks for your suggestion, I've tried to use pending
, but that would mark the entire test task as failed with Exit status 1
by nightwatch-cucumber
.
Hmm. Okay,, how does the following sound: we introduce an interface that allows a hook or a step to be able to say "mark me as skipped"? Once any hook / step is anything other than passing, the rest of the scenario is already skipped. We can do something very similar to pending for now where you simply need to return the string 'skipped'.
@charlierudolph Sounds good to me
Shouldn't be too hard to implement then. If you or anyone else would like to try and implement this: I think we can model this pretty well after pending steps. I'd suggest starting with a feature test similar to the pending steps feature and then adding in some logic to support it here. For now I don't think we need to add any other type of reporting or anything.
An alternate point of view: I don't know if it'll break a major design decision at the very core of cucumber, but it would be extremely useful if FeforeFeatures, BeforeFeature, BeforeScenario and BeforeStep could mutate their cucumber payloads and affect the behavior of the future testflow.
Among these mutations, a .skip()
option would be a good first candidate to implement.
I imagine there're a lot of benefits to the testflow being immutable once it's loaded. Is it an intentional design feature in cucumber?
@yaronassa Can you please open a new issue for your comment and clarify what you mean by affect the behavior of the future workflow? What are some examples of what you need to change?
I skip scenarios using following hook:
Before('@Pending', function (scenario, callback) {
callback(null, 'pending');
});
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
I skip scenarios using following hook:
Before('@Pending', function (scenario, callback) {
callback(null, 'pending');
});