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

Add command line argument handling for running single scenarios in features #168

Closed
wants to merge 1 commit into from

Conversation

simonlampen
Copy link
Contributor

Like other cucumber implementations, it would be nice to be able to run just a single scenario in a large feature file using the command line argument pattern featurefilename.feature:linenum.

This involved making sure any "expandPaths" calls could ignore, yet preserve, the line number suffix, so that once the feature file source is loaded, the parser has access to the scenario.getUri() with the specified line number (if any). Then an astFilter can simply include or exclude scenarios if a line number was passed.

I had to fix one unimplemented (mislabelled) step in cli_steps.js and also apply the patch in issue #120 / #123 because the stdout not being fully flushed causes the cli.features to fail.

Look forward to any feedback.

Cheers
Simon

…ature files with the pattern featurefilename.feature:linenum
@pscheit
Copy link

pscheit commented Apr 30, 2014

can u give a usage example how the command call would look like?

@simonlampen
Copy link
Contributor Author

Hi Philipp,
Sure you simply add the line number after the feature file the same as the ruby implementation
eg: cucumber.js features/a.feature:2

There is a test in the commit that uses this format.

Cheers
Simon

@jbpros jbpros closed this in aa82f4f May 22, 2014
@jbpros
Copy link
Member

jbpros commented May 22, 2014

Thanks for this nice work @simonlampen.

I've merged it but it could be improved some more to reflect cucumber-rb's behaviour.

‣ cucumber -h
Usage: cucumber [options] [ [FILE|DIR|URL][:LINE[:LINE]*] ]+

Examples:
cucumber examples/i18n/en/features
cucumber @rerun.txt (See --format rerun)
cucumber examples/i18n/it/features/somma.feature:6:98:113
cucumber -s -i http://rubyurl.com/eeCl

See how you can specify several lines at once? I don't personally use it but I can see how some people might find it useful.

There's also the -l/--lines option but I'm not sure it's super important to support that one. I wonder if anyone is using that at all.

@simonlampen
Copy link
Contributor Author

Thanks Julien,
I might have a go at adding the multiple lines when I next get near the code ;)
Cheers.

@jbpros
Copy link
Member

jbpros commented May 23, 2014

@simonlampen Thank you! That'd be great :)

@lock
Copy link

lock bot commented Oct 25, 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 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants