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

undefined method `ok?' for #<Cucumber::Core::Test::Result::Unknown #243

Closed
JakeKaad opened this issue Aug 3, 2017 · 6 comments
Closed

Comments

@JakeKaad
Copy link

JakeKaad commented Aug 3, 2017

Summary

When running cucumber using my default profile in --dry-run one of my features fails with the error message undefined method 'ok?' for #<Cucumber::Core::Test::Result::Unknown

I am not very familiar with the cucumber source code, but it looks like Result::Unknown objects are not supposed to be created in --dry-run.

Default profile

--tags ~@known-failure --format pretty --format rerun --out last_run_failures

Backtrace

undefined method `ok?' for #<Cucumber::Core::Test::Result::Unknown:0x007ffbfdcba768> (NoMethodError)
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-2.4.0/lib/cucumber/formatter/rerun.rb:15:in `after_test_case'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-2.4.0/lib/cucumber/formatter/ignore_missing_messages.rb:10:in `method_missing'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-2.4.0/lib/cucumber/formatter/legacy_api/adapter.rb:45:in `after_test_case'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-2.4.0/lib/cucumber/formatter/fanout.rb:16:in `block in method_missing'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-2.4.0/lib/cucumber/formatter/fanout.rb:15:in `each'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-2.4.0/lib/cucumber/formatter/fanout.rb:15:in `method_missing'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-1.5.0/lib/cucumber/core/test/runner.rb:19:in `test_case'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-1.5.0/lib/cucumber/core/test/case.rb:23:in `describe_to'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-2.4.0/lib/cucumber/filters/activate_steps.rb:11:in `test_case'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-1.5.0/lib/cucumber/core/test/case.rb:23:in `describe_to'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-2.4.0/lib/cucumber/filters/quit.rb:11:in `test_case'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-1.5.0/lib/cucumber/core/test/case.rb:23:in `describe_to'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-1.5.0/lib/cucumber/core/test/filters/locations_filter.rb:17:in `block in done'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-1.5.0/lib/cucumber/core/test/filters/locations_filter.rb:16:in `each'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-1.5.0/lib/cucumber/core/test/filters/locations_filter.rb:16:in `done'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-1.5.0/lib/cucumber/core/filter.rb:61:in `done'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-1.5.0/lib/cucumber/core/test/filters/tag_filter.rb:18:in `done'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-1.5.0/lib/cucumber/core/compiler.rb:23:in `done'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-1.5.0/lib/cucumber/core/gherkin/parser.rb:35:in `done'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-1.5.0/lib/cucumber/core.rb:29:in `parse'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-1.5.0/lib/cucumber/core.rb:18:in `compile'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-2.4.0/lib/cucumber/runtime.rb:67:in `run!'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-2.4.0/lib/cucumber/cli/main.rb:32:in `execute!'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-2.4.0/bin/cucumber:8:in `<top (required)>'
/Users/jake/.rvm/gems/ruby-2.3.1/bin/cucumber:23:in `load'
/Users/jake/.rvm/gems/ruby-2.3.1/bin/cucumber:23:in `<main>'
/Users/jake/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `eval'
/Users/jake/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `<main>'

Expected Behavior

Current Behavior

Possible Solution

As a workaround I monkey patched #ok? on Cucumber::Core::Test::Result::Unknown.

Steps to Reproduce (for bugs)

To be honest, I am not sure how to reproduce. I'd be happy to pair with somebody to figure it out.

Context & Motivation

I use --dry-run to take inventory of scenarios and steps.

Your Environment

  • Version used: 2.4.0
  • Operating System and version: macOS 10.12
  • Link to your project:
@brasmusson
Copy link
Contributor

This is already fixed by cucumber/cucumber-ruby#967, the cucumber gem v3.0.0.pre.2 (and v3.0.0.pre.1) contains the fix.

@JakeKaad
Copy link
Author

JakeKaad commented Aug 3, 2017

@brasmusson I installed v3.0.0.pre.2 and the bug still exists.

@aslakhellesoy
Copy link
Contributor

@JakeKaad can you please supply the backtrace you get with v3.0.0.pre.2?

@JakeKaad
Copy link
Author

JakeKaad commented Aug 4, 2017

@aslakhellesoy Sure. Here you go.

undefined method `ok?' for #<Cucumber::Core::Test::Result::Unknown:0x007fcd48990698> (NoMethodError)
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-3.0.0.pre.2/lib/cucumber/formatter/console_issues.rb:15:in `block in initialize'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-3.0.0.pre.2/lib/cucumber/core/event_bus.rb:34:in `block in broadcast'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-3.0.0.pre.2/lib/cucumber/core/event_bus.rb:34:in `each'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-3.0.0.pre.2/lib/cucumber/core/event_bus.rb:34:in `broadcast'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-3.0.0.pre.2/lib/cucumber/core/event_bus.rb:40:in `method_missing'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-3.0.0.pre.2/lib/cucumber/core/test/runner.rb:20:in `test_case'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-3.0.0.pre.2/lib/cucumber/core/test/case.rb:25:in `describe_to'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-3.0.0.pre.2/lib/cucumber/filters/activate_steps.rb:12:in `test_case'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-3.0.0.pre.2/lib/cucumber/core/test/case.rb:25:in `describe_to'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-3.0.0.pre.2/lib/cucumber/core/test/filters/locations_filter.rb:18:in `block in done'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-3.0.0.pre.2/lib/cucumber/core/test/filters/locations_filter.rb:17:in `each'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-3.0.0.pre.2/lib/cucumber/core/test/filters/locations_filter.rb:17:in `done'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-3.0.0.pre.2/lib/cucumber/core/filter.rb:62:in `done'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-3.0.0.pre.2/lib/cucumber/core/test/filters/tag_filter.rb:18:in `done'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-3.0.0.pre.2/lib/cucumber/core/compiler.rb:24:in `done'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-3.0.0.pre.2/lib/cucumber/core/gherkin/parser.rb:37:in `done'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-3.0.0.pre.2/lib/cucumber/core.rb:32:in `parse'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-core-3.0.0.pre.2/lib/cucumber/core.rb:21:in `compile'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-3.0.0.pre.2/lib/cucumber/runtime.rb:74:in `run!'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-3.0.0.pre.2/lib/cucumber/cli/main.rb:33:in `execute!'
/Users/jake/.rvm/gems/ruby-2.3.1/gems/cucumber-3.0.0.pre.2/bin/cucumber:8:in `<top (required)>'
/Users/jake/.rvm/gems/ruby-2.3.1/bin/cucumber:23:in `load'
/Users/jake/.rvm/gems/ruby-2.3.1/bin/cucumber:23:in `<main>'
/Users/jake/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `eval'
/Users/jake/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `<main>'

@brasmusson
Copy link
Contributor

Yep, --dry-run with features containing empty scenarios give this exception. I think the solution is to modify the Cucumber-Ruby compiler to not create Test Cases for empty Scenarios - which is consistent with the Gherkin compiler which does not create Pickles for empty Scenarios. See cucumber/cucumber-ruby-core#144.

@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
None yet
Projects
None yet
Development

No branches or pull requests

3 participants