-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Add ambiguous result type #139
Conversation
Added a new result type for tests that encounter ambiguous steps.
@mattwynne @tooky please take a look at this and the new changes in the old PR in order to know if we are going to the right direction or not. Thx :) |
Hi @MadameSheema you're definitely going in the right direction! Using this I think there's a subtle question about whether this specialisation of the |
@mattwynne So far, we've been putting the new stuff next to its relatives. So if these new classes don't belong here, then there's a good chance that the existing ones don't belong here either. We've got one of the tests to the point where it just fails instead of exploding, but we haven't yet found the spot in the code that is responsible for outputting the ambiguous step message. The message that is in the error class class looks exactly like what we want but we need to get it output somewhere. |
@mattwynne Really? |
end | ||
|
||
def to_s | ||
"F" |
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 should rather be "A" - for "Ambiguous".
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.
I agree, I hit this in Cucumber JS the other day, and I wonder if we should just do exactly the same as them to stay consistent (except offering to --guess
).
💡 in fact, why don't we just steal their acceptance test...
https://github.com/cucumber/cucumber-js/blob/master/features/ambiguous_step.feature
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.
Theft? In Open Source? For shame! ;)
Seriously though, yes, that was an initial idea but it somehow ended up starting with the even more basic case of failure rather than a special return type like ambiguous. Given what i have now seen of the code, however, I may be able to make it return the correct type, even if I still can't get the output correct.
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.
Let's steal the idea :P
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.
starting with the even more basic case of failure
In that case, an Ambiguous
class should not be defined here, so defining it here implies a new result category in the summary (N Scenarios (X failed, Y ambiguous, ... )
end | ||
|
||
def ok?(be_strict = false) | ||
!be_strict |
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.
Shouldn't this be false
so that the exit code becomes non-zero when an ambiguous step is found?
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.
It's based on what the Undefined
type is does. It's not good but it's not bad unless --strict
is used.
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.
But the feature file says Then it should fail with:
, and if it is not bad unless --strict
then the scenario should say Then it should pass with:
The other result types have specs in result_spec.rb, so it should be updated to cover also the |
You're right, as usual. 😀 Sorry for adding any confusion. |
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 PR needs to be rebased since #140 has made some ground work for adding new result types.
end | ||
|
||
def ok?(be_strict = false) | ||
!be_strict |
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.
But the feature file says Then it should fail with:
, and if it is not bad unless --strict
then the scenario should say Then it should pass with:
end | ||
|
||
def to_s | ||
"F" |
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.
starting with the even more basic case of failure
In that case, an Ambiguous
class should not be defined here, so defining it here implies a new result category in the summary (N Scenarios (X failed, Y ambiguous, ... )
@@ -16,7 +16,7 @@ def self.query_methods(result_type) | |||
result_type | |||
end | |||
|
|||
[:passed, :failed, :undefined, :unknown, :skipped, :pending].each do |possible_result_type| | |||
[:passed, :failed, :undefined, :unknown, :skipped, :pending, :ambiguous].each do |possible_result_type| |
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.
These symbols definitions has been moved to a module level constant, so :ambiguous
should be added there instead, and since the order control the order in the summary listing, I think is should be defined directly after :failed
include Result.query_methods :ambiguous | ||
|
||
def describe_to(visitor, *args) | ||
visitor.failed(*args) |
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.
The ambiguous result should describe itself as ambiguous
to the visitors (which also requires and ambiguous
method in the RunningTestCase
- same definition as undefined
works)
"F" | ||
end | ||
|
||
def ok?(be_strict = false) |
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.
Now the ok?
methods are defined as class methods - and for Ambiguous
is should always be false
(as long as the scenarios says Then it should fail with
)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week if no further activity occurs. |
Summary
Added a new result type for tests that encounter ambiguous steps.
Details
With this PR and the PR: cucumber/cucumber-ruby#1132 we are trying to fix the issue #1113
Motivation and Context
cucumber/cucumber-ruby#1113
Types of changes
Checklist: