You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having an issue when using cucumber --format stepdefs when there is a typo in my step.
The cucumber --format stepdefs stack trace is too harsh and doesn't provide guidance to a solution.
Issues #953 and #955 point out a problem with using the --format stepdefs flag but don't clarify the problem or provide a solution.
The work around solution is:
remove the step
comment out the step
make a stub definition of the step
Main idea
Given I first installed cucumber and aruba
And I'm not an expert at debugging Ruby applications
And I make a typo in my step
And I want to check out the avaiable step definitions to see what my typo was
When I run `cucumber --format stepdefs`
Then the command should fail
And I shouldn't be shown a 40 line Ruby stack trace
And there should be a helpful error message that looks something like:
"""
You can't use the `--format stepdefs` flag with undefined steps!
Implement the steps and try again.
You can implement step definitions for undefined steps with these snippets:
Then("the command should pass with:") do |string|
pending # Write code here that turns the phrase above into concrete actions
end
"""
Or, there should be a feature to just preview all the steps.
Or, the `--dry-run` switch should work.
Steps to Reproduce (for bugs)
gem install cucumber:3.1.0 aruba:0.14.5
mkdir cukular_bomb
cd cukular_bomb/
cucumber --init
cat <<'EOF' > features/support/env.rb
require 'aruba/cucumber'
EOF
cat <<'EOF' > features/helloruby.feature
Feature: Ruby's command line interface
Scenario: Using the -e flag
When I run `ruby -e 'print "hello world!"'`
Then the command should pass with:
"""
hello world!
"""
EOF
cucumber
cucumber --format stepdefs
cucumber --format stepdefs 2>&1 | awk 'END { print NR }'
Context & Motivation
Showing a user a 40 line stack trace for making a typo in the step definition is too harsh and not helpful.
Your Environment
sw_vers
ProductName: Mac OS X
ProductVersion: 10.12.6
BuildVersion: 16G1036
gem list cucumber aruba
*** LOCAL GEMS ***
cucumber (3.1.0)
cucumber-core (3.1.0, 2.0.0)
cucumber-expressions (5.0.13)
cucumber-tag_expressions (1.1.1)
cucumber-wire (0.0.1)
*** LOCAL GEMS ***
aruba (0.14.5)
Summary
Thank you for this project!
I'm having an issue when using
cucumber --format stepdefs
when there is a typo in my step.The cucumber --format stepdefs stack trace is too harsh and doesn't provide guidance to a solution.
Issues #953 and #955 point out a problem with using the
--format stepdefs
flag but don't clarify the problem or provide a solution.The work around solution is:
Main idea
Steps to Reproduce (for bugs)
Context & Motivation
Showing a user a 40 line stack trace for making a typo in the step definition is too harsh and not helpful.
Your Environment
Also, there is a repo I put together that will also reproduce the error: https://github.com/mbigras/cukular_bomb
Stack trace for reference
The text was updated successfully, but these errors were encountered: