Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support to imperatively skip scenario #873

Closed
kidwm opened this issue Jul 3, 2017 · 12 comments
Closed

Support to imperatively skip scenario #873

kidwm opened this issue Jul 3, 2017 · 12 comments
Labels
good first issue Good for newcomers 🙏 help wanted Help wanted - not prioritized by core team

Comments

@kidwm
Copy link

kidwm commented Jul 3, 2017

There is a skip_this_scenario function in Ruby version.

Is it able to skip scenario imperatively in JavaScript version?

@charlierudolph
Copy link
Member

No that is not currently available. Can you point me to the cucumber-ruby documentation or give an example of the use case?

@kidwm
Copy link
Author

kidwm commented Jul 3, 2017

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.

@charlierudolph
Copy link
Member

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.

@mattwynne
Copy link
Member

@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.

@kidwm
Copy link
Author

kidwm commented Jul 4, 2017

@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.

@kidwm kidwm changed the title Support to skip scenario Support to imperatively skip scenario Jul 4, 2017
@charlierudolph
Copy link
Member

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'.

@kidwm
Copy link
Author

kidwm commented Jul 4, 2017

@charlierudolph Sounds good to me

@charlierudolph
Copy link
Member

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.

@charlierudolph charlierudolph added 🙏 help wanted Help wanted - not prioritized by core team good first issue Good for newcomers labels Jul 4, 2017
@yaronassa
Copy link

yaronassa commented Jul 4, 2017

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?

@charlierudolph
Copy link
Member

@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?

@RamneetSaund
Copy link

RamneetSaund commented Aug 29, 2017

I skip scenarios using following hook:

Before('@Pending', function (scenario, callback) {
callback(null, 'pending');
});

@lock
Copy link

lock bot commented Oct 24, 2018

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.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Good for newcomers 🙏 help wanted Help wanted - not prioritized by core team
Projects
None yet
Development

No branches or pull requests

5 participants