-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fixed lengthy stacktrace when running cucumber -f stepdefs
when steps aren't defined
#1286
Fixed lengthy stacktrace when running cucumber -f stepdefs
when steps aren't defined
#1286
Conversation
…unning `-f stepdefs`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a helpful step to make people more welcome to the project.
Thanks for reviewing these PRs, @olleolleolle! :) |
Nice @xtrasimplicity! Question: Do you think the exit status should be non-zero? I think there shouldn't be a long stack trace but the exit status should be non-zero because all the steps weren't successfully run. Also, there are probably tools make decisions about what to do next based on cucumber's exit status. Exiting 0 for an undefined step might not be what folks expect. |
@mbigras, The fix I implemented changed the Whether or not a test suite with undefined steps should yield a non-zero exit code is something that I would consider to be a breaking change. I'm also not sure whether returning a successful exit code when undefined steps are present was the desired functionality, or whether it just turned out to be that way. @olleolleolle / @mvz, would you be able to provide some insight into this? Thanks! |
I haven't been around long enough to know the original intent, but to me it makes sense that output format and exit code are orthogonal concerns, so the exit code with |
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. |
Summary
Currently, when running
cucumber -f stepdefs
against features which don't include step definitions, a lengthy stacktrace is shown to the user. This is thoroughly described in issue #1285.Details
I've simply added a condition to prevent a
NoMethodError
from being raised, if a step hasn't been defined for a test case. When an error isn't raised, example snippets are printed to stdout, as shown in the following test case:Motivation and Context
As described in issue #1285, it can be difficult for new users to understand what went wrong, when they mis-type a step, or fail to define one, and are shown a 40 line stacktrace.
How Has This Been Tested?
I've added an additional feature to
features/docs/formatters/usage_formatter.feature
.Types of changes
Checklist:
This change is