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

dry-run error :: can't dup NilClass (TypeError) #109

Closed
sgreen-r7 opened this issue Jun 10, 2016 · 2 comments
Closed

dry-run error :: can't dup NilClass (TypeError) #109

sgreen-r7 opened this issue Jun 10, 2016 · 2 comments

Comments

@sgreen-r7
Copy link

I already found the cause to this error, however I just wanted to post this here incase anybody else comes across the same issue. After the upgrade from cucumber 2.3.3 to 2.4.0 I ran into the error/stacktrace below. The culprit scenario file had not be changed and started failing only after the upgrade to 2.4.0, and was found during a --dry-run.

code:ruby
Scenario Outline: Lorem ipsum dolor sit amet
Given consectetur adipiscing elit
When proin non varius est <page_size> maecenas eu magna tempus
Then consectetur nibh eu, cursus diam maecenas

Examples:
Examples:
  |page_size |page   |count |
  | 5        |  1    | 5    |
  | 10       |  2    | 10   |
  | 25       |  1    | 25   |

The error happens due to `Examples:` being listed twice for the `Scenario Outline`. And again I bring this up because we were not getting this error prior to upgrading to cucumber 2.4.0. 

Env: `ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin13]`
Command: `bundle exec cucumber --dry-run`
Error: `can't dup NilClass (TypeError)` 
Stacktrace:

``` code:ruby```
└─[2] <git:(master 7c34199✱✈) $> cucumber --dry-run
can't dup NilClass (TypeError)
/Users/sgreen/.rvm/gems/ruby-2.2.2@nexpose-cucumber/gems/cucumber-core-1.5.0/lib/cucumber/core/gherkin/ast_builder.rb:31:in `dup'
/Users/sgreen/.rvm/gems/ruby-2.2.2@nexpose-cucumber/gems/cucumber-core-1.5.0/lib/cucumber/core/gherkin/ast_builder.rb:31:in `initialize'
/Users/sgreen/.rvm/gems/ruby-2.2.2@nexpose-cucumber/gems/cucumber-core-1.5.0/lib/cucumber/core/gherkin/ast_builder.rb:308:in `new'
/Users/sgreen/.rvm/gems/ruby-2.2.2@nexpose-cucumber/gems/cucumber-core-1.5.0/lib/cucumber/core/gherkin/ast_builder.rb:308:in `initialize'
/Users/sgreen/.rvm/gems/ruby-2.2.2@nexpose-cucumber/gems/cucumber-core-1.5.0/lib/cucumber/core/gherkin/ast_builder.rb:274:in `new'
/Users/sgreen/.rvm/gems/ruby-2.2.2@nexpose-cucumber/gems/cucumber-core-1.5.0/lib/cucumber/core/gherkin/ast_builder.rb:274:in `block in initialize'
/Users/sgreen/.rvm/gems/ruby-2.2.2@nexpose-cucumber/gems/cucumber-core-1.5.0/lib/cucumber/core/gherkin/ast_builder.rb:274:in `map'
/Users/sgreen/.rvm/gems/ruby-2.2.2@nexpose-cucumber/gems/cucumber-core-1.5.0/lib/cucumber/core/gherkin/ast_builder.rb:274:in `initialize'
/Users/sgreen/.rvm/gems/ruby-2.2.2@nexpose-cucumber/gems/cucumber-core-1.5.0/lib/cucumber/core/gherkin/ast_builder.rb:133:in `new'
/Users/sgreen/.rvm/gems/ruby-2.2.2@nexpose-cucumber/gems/cucumber-core-1.5.0/lib/cucumber/core/gherkin/ast_builder.rb:133:in `block in initialize'
/Users/sgreen/.rvm/gems/ruby-2.2.2@nexpose-cucumber/gems/cucumber-core-1.5.0/lib/cucumber/core/gherkin/ast_builder.rb:126:in `map'
/Users/sgreen/.rvm/gems/ruby-2.2.2@nexpose-cucumber/gems/cucumber-core-1.5.0/lib/cucumber/core/gherkin/ast_builder.rb:126:in `initialize'
/Users/sgreen/.rvm/gems/ruby-2.2.2@nexpose-cucumber/gems/cucumber-core-1.5.0/lib/cucumber/core/gherkin/ast_builder.rb:105:in `new'
/Users/sgreen/.rvm/gems/ruby-2.2.2@nexpose-cucumber/gems/cucumber-core-1.5.0/lib/cucumber/core/gherkin/ast_builder.rb:105:in `feature'
/Users/sgreen/.rvm/gems/ruby-2.2.2@nexpose-cucumber/gems/cucumber-core-1.5.0/lib/cucumber/core/gherkin/ast_builder.rb:16:in `feature'
/Users/sgreen/.rvm/gems/ruby-2.2.2@nexpose-cucumber/gems/cucumber-core-1.5.0/lib/cucumber/core/gherkin/parser.rb:28:in `document'
/Users/sgreen/.rvm/gems/ruby-2.2.2@nexpose-cucumber/gems/cucumber-core-1.5.0/lib/cucumber/core.rb:27:in `block in parse'
/Users/sgreen/.rvm/gems/ruby-2.2.2@nexpose-cucumber/gems/cucumber-core-1.5.0/lib/cucumber/core.rb:26:in `each'
/Users/sgreen/.rvm/gems/ruby-2.2.2@nexpose-cucumber/gems/cucumber-core-1.5.0/lib/cucumber/core.rb:26:in `parse'
/Users/sgreen/.rvm/gems/ruby-2.2.2@nexpose-cucumber/gems/cucumber-core-1.5.0/lib/cucumber/core.rb:18:in `compile'
/Users/sgreen/.rvm/gems/ruby-2.2.2@nexpose-cucumber/gems/cucumber-2.4.0/lib/cucumber/runtime.rb:67:in `run!'
/Users/sgreen/.rvm/gems/ruby-2.2.2@nexpose-cucumber/gems/cucumber-2.4.0/lib/cucumber/cli/main.rb:32:in `execute!'
/Users/sgreen/.rvm/gems/ruby-2.2.2@nexpose-cucumber/gems/cucumber-2.4.0/bin/cucumber:8:in `<top (required)>'
/Users/sgreen/.rvm/gems/ruby-2.2.2@nexpose-cucumber/bin/cucumber:23:in `load'
/Users/sgreen/.rvm/gems/ruby-2.2.2@nexpose-cucumber/bin/cucumber:23:in `<main>'
/Users/sgreen/.rvm/gems/ruby-2.2.2@nexpose-cucumber/bin/ruby_executable_hooks:15:in `eval'
/Users/sgreen/.rvm/gems/ruby-2.2.2@nexpose-cucumber/bin/ruby_executable_hooks:15:in `<main>'
brasmusson added a commit that referenced this issue Jun 11, 2016
Gherkin v4.0 is more allowing with respect to incomplete scenario
outlines, therefore Cucumber::Core::Gherkin::AstBuilder need to also be
that.
@brasmusson
Copy link
Contributor

As Gherkin v3.2.0 (used in Cucumber-Ruby v2.3.3) does not allow empty Examples: sections, one would expect that the above feature should trigger a parser error in Gherkin v3.2.0. But what really happens is that the second Examples: line is parsed as a description (ast node) to the first Examples: line.

With Gherkin v4.0.0 the feature file is now (correctly) parsed as a scenario outline with two Examples: sections, one completely empty (which is allowed in Gherkin v4.0.0) and one with an examples table in it. As Gherkin now is allowing different variants of incomplete scenario outline, Cucumber-Ruby must also handle those cases, but as this issue points out - it does not do that yet.

CyrilPatrice pushed a commit to PagesjaunesMobile/cucumber-ruby-core that referenced this issue Feb 1, 2017
Gherkin v4.0 is more allowing with respect to incomplete scenario
outlines, therefore Cucumber::Core::Gherkin::AstBuilder need to also be
that.
@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