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

cucumber2: cannot find tags #771

Closed
akostadinov opened this issue Nov 10, 2014 · 11 comments
Closed

cucumber2: cannot find tags #771

akostadinov opened this issue Nov 10, 2014 · 11 comments

Comments

@akostadinov
Copy link
Contributor

running cucumber like cucumber features/test/tmp.feature:91 works but running like cucumber --tags @pry results in:

undefined method `describe_to' for nil:NilClass (NoMethodError)
/usr/local/share/gems/gems/rspec-expectations-2.14.4/lib/rspec/matchers/method_missing.rb:9:in `method_missing'
/home/avalon/.gem/ruby/gems/cucumber-core-1.0.0.beta.3/lib/cucumber/core/compiler.rb:12:in `feature'
/home/avalon/.gem/ruby/gems/cucumber-core-1.0.0.beta.3/lib/cucumber/core/gherkin/parser.rb:19:in `document'
/home/avalon/.gem/ruby/gems/cucumber-core-1.0.0.beta.3/lib/cucumber/core.rb:12:in `block in parse'
/home/avalon/.gem/ruby/gems/cucumber-core-1.0.0.beta.3/lib/cucumber/core.rb:11:in `each'
/home/avalon/.gem/ruby/gems/cucumber-core-1.0.0.beta.3/lib/cucumber/core.rb:11:in `parse'
/home/avalon/.gem/ruby/gems/cucumber-core-1.0.0.beta.3/lib/cucumber/core.rb:23:in `compile'
/home/avalon/.gem/ruby/gems/cucumber-core-1.0.0.beta.3/lib/cucumber/core.rb:31:in `execute'
/home/avalon/.gem/ruby/gems/cucumber-2.0.0.beta.3/lib/cucumber/runtime.rb:71:in `run!'
/home/avalon/.gem/ruby/gems/cucumber-2.0.0.beta.3/lib/cucumber/cli/main.rb:38:in `execute!'
/home/avalon/.gem/ruby/gems/cucumber-2.0.0.beta.3/bin/cucumber:9:in `<top (required)>'
/usr/local/bin/cucumber:23:in `load'
/usr/local/bin/cucumber:23:in `<main>'

The same worked in 1.3.x

@mikz
Copy link

mikz commented Nov 12, 2014

For me I get the same error when when running just cucumber.
edit: I have features/api/somefeature.feature

@mattwynne
Copy link
Member

Can someone give us a concrete case to reproduce this from?

@mikz
Copy link

mikz commented Nov 13, 2014

@mattwynne in empty folder with 2.0.0.beta.3:

mkdir -p features/api
touch features/api/buckets.feature
cucumber features/api/buckets.feature

erran referenced this issue in erran/cucumber-issue-771 Dec 2, 2014
+ Add a plain file that matches what @akostadinov described.
+ Add a empty file based on @mikz's instructions.
@erran
Copy link
Contributor

erran commented Dec 2, 2014

@mattwynne Check out erran/cucumber-issue-771:

@akostadinov
Copy link
Contributor Author

@erran , thank you for looking into that issue. Let me explain some differences in my usage. I have the tag set for the scenario, not the whole feature. Also I am not running cucumber features/subdirectory/nested.feature --tags @sometag but cucumber --tags @sometag. With cucumber 1.x both work fine while with 2.x the former works and the latter does not work.
I hope this clarifies it.

@erran
Copy link
Contributor

erran commented Dec 2, 2014

@akostadinov I moved the tag to the Scenario level erran/cucumber-issue-771@2dda985. I see the error you described with the empty file using anything that runs parses the bad file: cucumber, cucumber --tags @sometag, or cucumber features/api/buckets.feature. The nested file itself does not generate the error for me though. Do you know of an empty file or a file with some sort of malformed Gherkin in your test suite?

@akostadinov
Copy link
Contributor Author

@erran, hah, it turned out that I really had an empty feature file. Removing that feature file made cucumber work. Hopefully cucumber can be more resilient to parse errors and/or log the offending files so user can fix.
Big thank you for the help though because now things work for me.

@brasmusson
Copy link
Contributor

What I can see this issue is all about the handling of totally empty feature files in Cucumber v2.0.0.beta3. When running cucumber features/test/tmp.feature:91, any empty feature file in the features directory will not be read, so it works as expected. But when running cucumber --tags @pry all feature files will be searched for features/scenarios with the tag @pry, so the undefined method error is triggered when processing an empty feature files. It has nothing to do with the tag handling of Cucumber.

The handling of empty feature files is fixed by cucumber/cucumber-ruby-core#77.

@akostadinov
Copy link
Contributor Author

that's correct

@mattwynne
Copy link
Member

Thanks Bjorn!

@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

No branches or pull requests

5 participants