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 `with_appended_backtrace' for Cucumber::Core::Test::Result::Unknown #95

Closed
nvenky opened this issue Aug 5, 2015 · 4 comments

Comments

@nvenky
Copy link

nvenky commented Aug 5, 2015

All our features are failing after running the individual steps successfully (Only on v1.2.0). We get the following Backtrace at the end:

Looks like a new method with_appended_backtrace has been added to the Cucumber::Core::Test::Result but it is missing for Cucumber::Core::Test::Result::Unknown result class.
I could see that it was added as part of this Commit: 0a31e95

Backtrace:
undefined method with_appended_backtrace' for #<Cucumber::Core::Test::Result::Unknown:0x441ce58> (NoMethodError) c:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-core-1.2.0/lib/cucumber/core/test/runner.rb:101:inexecute'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-core-1.2.0/lib/cucumber/core/test/runner.rb:46:in execute' c:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-core-1.2.0/lib/cucumber/core/test/runner.rb:30:inaround_hook'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-core-1.2.0/lib/cucumber/core/test/around_hook.rb:11:in describe_to' c:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-core-1.2.0/lib/cucumber/core/test/case.rb:92:inblock (2 levels) in compose_around_hooks'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-core-1.2.0/lib/cucumber/core/test/case.rb:91:in call' c:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-core-1.2.0/lib/cucumber/core/test/case.rb:91:incompose_around_hooks'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-core-1.2.0/lib/cucumber/core/test/case.rb:22:in block in describe_to' c:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-core-1.2.0/lib/cucumber/core/test/runner.rb:17:incall'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-core-1.2.0/lib/cucumber/core/test/runner.rb:17:in test_case' c:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-core-1.2.0/lib/cucumber/core/test/case.rb:21:indescribe_to'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/filters/prepare_world.rb:11:in test_case' c:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-core-1.2.0/lib/cucumber/core/test/case.rb:21:indescribe_to'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/filters/apply_around_hooks.rb:8:in test_case' c:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-core-1.2.0/lib/cucumber/core/test/case.rb:21:indescribe_to'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/filters/apply_after_hooks.rb:5:in test_case' c:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-core-1.2.0/lib/cucumber/core/test/case.rb:21:indescribe_to'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/filters/apply_before_hooks.rb:5:in test_case' c:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-core-1.2.0/lib/cucumber/core/test/case.rb:21:indescribe_to'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/filters/apply_after_step_hooks.rb:8:in test_case' c:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-core-1.2.0/lib/cucumber/core/test/case.rb:21:indescribe_to'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/filters/activate_steps.rb:8:in test_case' c:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-core-1.2.0/lib/cucumber/core/test/case.rb:21:indescribe_to'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-2.0.2/lib/cucumber/filters/quit.rb:11:in `test_case'

@brasmusson
Copy link
Contributor

@nvenky How have you defined your around hooks, making them respond_to?(:source)? We do not see this problem when running the around_hooks.feature, since the around hooks defined there does not respond_to?(:source), and therefore with_appended_backtrace does not get called on the (unknown) results from them in cucumber/core/test/runner.rb:101.

@nvenky
Copy link
Author

nvenky commented Aug 20, 2015

@brasmusson - We don't have any around_hooks in our project. I tried to narrow down the issue and found that we had included a Module into the global context that had 'Capybara::DSL' included internally.

features\support\application.rb

include TestHelpers

test_helpers.rb

module TestHelpers
  include Capybara::DSL

We fixed the issue by removing the 'include TestHelpers' statement and using World instead.

Above code used to work in the previous cucumber version but you can close the issue if it is not important.

@brasmusson
Copy link
Contributor

Yes, including Capybara::DSL into the global context does make test steps from around hooks respond_to?(:source), and since Cucumber always apply an around hook internally to fire the begin_scenario and end_scenario event, this error will then always occur.

The most straightforward solution is to use another method of the Cucumber::Core::Test::Step (a method with a less commonly used name), to ensure that it is a test step from a step (and not a from a hook) before test_step.source.last is accessed (and passed to result.with_appended_backtrace).

@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

2 participants