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

[Core Bug Fix] Fixed runtime exit status for ambiguous scenarios #1342

Merged
merged 3 commits into from
Apr 8, 2018
Merged

[Core Bug Fix] Fixed runtime exit status for ambiguous scenarios #1342

merged 3 commits into from
Apr 8, 2018

Conversation

prashant-ramcharan
Copy link
Member

@prashant-ramcharan prashant-ramcharan commented Apr 7, 2018

Summary

Fixed an issue where a successful runtime exit status (0x0) is returned for ambiguous scenarios when runtime option 'strict' is set to true.

Details

When using the Cucumber CLI and an AmbiguousStepDefinitionsException is raised, the runtime exit status is 0x0 even though runtime option 'strict' is set to true.

The runtime exit status should be 0x1 when isStrict

Motivation and Context

How Has This Been Tested?

Yes - 2 new tests added.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).

Checklist:

  • I've added tests for my code.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@prashant-ramcharan prashant-ramcharan changed the title [CORE-BUG-FIX] Fixed runtime exit status for ambiguous scenarios [Core Bug Fix] Fixed runtime exit status for ambiguous scenarios Apr 7, 2018
@coveralls
Copy link

coveralls commented Apr 7, 2018

Coverage Status

Coverage remained the same at 81.595% when pulling 2e30f73 on prashant-ramcharan:strict-ambiguous-scenarios-fix into a82de71 on cucumber:master.

Copy link
Contributor

@mpkorstanje mpkorstanje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey thanks for reporting and trying to fix this. Much appreciated!

Can you make it so ambiguousScenarios is treated the same as failedScenarios with respect to isStrict?

@@ -94,7 +94,7 @@ public void setEventPublisher(EventPublisher publisher) {

public byte exitStatus(boolean isStrict) {
byte result = 0x0;
if (!failedScenarios.isEmpty() || (isStrict && (!pendingScenarios.isEmpty() || !undefinedScenarios.isEmpty()))) {
if (!failedScenarios.isEmpty() || (isStrict && (!pendingScenarios.isEmpty() || !undefinedScenarios.isEmpty() || !ambiguousScenarios.isEmpty()))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at printNonZeroResultScenarios I think ambiguousScenarios should be treated the same as failedScenarios and always return a non zero exit status.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brasmusson This section feels like it's duplicating some functionality we have elsewhere already. I think we can improve this by using Result.SEVERITY from #1323 to find the worst the results and use Result.isOk(strict) to determine the exit code status.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it sure feels as duplication. Somehow, both here and in printNonZeroResultScenarios, Result.isOk should be used (instead of duplicating its logic).

@prashant-ramcharan
Copy link
Member Author

prashant-ramcharan commented Apr 7, 2018

Hi @mpkorstanje

ambiguousScenarios are now treated as failedScenarios.

@mpkorstanje mpkorstanje merged commit a35b443 into cucumber:master Apr 8, 2018
@aslakhellesoy
Copy link
Contributor

Hi @prashant-ramcharan,

Thanks for your making your first contribution to Cucumber, and welcome to the Cucumber committers team! You can now push directly to this repo and all other repos under the cucumber organization! 🍾

In return for this generous offer we hope you will:

  • ✅ Continue to use branches and pull requests. When someone on the core team approves a pull request (yours or someone else's), you're welcome to merge it yourself.
  • 💚 Commit to setting a good example by following and upholding our code of conduct in your interactions with other collaborators and users.
  • 💬 Join the community Slack channel to meet the rest of the team and make yourself at home.
  • ℹ️ Don't feel obliged to help, just do what you can if you have the time and the energy.
  • 🙋 Ask if you need anything. We're looking for feedback about how to make the project more welcoming, so please tell us!

On behalf of the Cucumber core team,
Aslak Hellesøy
Creator of Cucumber

mpkorstanje added a commit that referenced this pull request Apr 8, 2018
@mpkorstanje
Copy link
Contributor

Thanks!

@prashant-ramcharan prashant-ramcharan deleted the strict-ambiguous-scenarios-fix branch April 8, 2018 09:49
mpkorstanje added a commit that referenced this pull request Apr 20, 2018
@lock
Copy link

lock bot commented Apr 8, 2019

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 Apr 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants