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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/main/java/cucumber/runtime/Stats.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public List<Throwable> getErrors() {

public byte exitStatus(boolean isStrict) {
byte result = 0x0;
if (!failedScenarios.isEmpty() || (isStrict && (!pendingScenarios.isEmpty() || !undefinedScenarios.isEmpty()))) {
if (!failedScenarios.isEmpty() || !ambiguousScenarios.isEmpty() || (isStrict && (!pendingScenarios.isEmpty() || !undefinedScenarios.isEmpty()))) {
result |= ERRORS;
}
return result;
Expand Down
16 changes: 16 additions & 0 deletions core/src/test/java/cucumber/runtime/RuntimeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,22 @@ public void strict_with_failed_scenarios() {
assertEquals(0x1, runtime.exitStatus());
}

@Test
public void non_strict_with_ambiguous_scenarios() {
Runtime runtime = createNonStrictRuntime();
runtime.getEventBus().send(testCaseFinishedWithStatus(Result.Type.AMBIGUOUS));

assertEquals(0x1, runtime.exitStatus());
}

@Test
public void strict_with_ambiguous_scenarios() {
Runtime runtime = createStrictRuntime();
runtime.getEventBus().send(testCaseFinishedWithStatus(Result.Type.AMBIGUOUS));

assertEquals(0x1, runtime.exitStatus());
}

@Test
public void should_pass_if_no_features_are_found() throws IOException {
ResourceLoader resourceLoader = createResourceLoaderThatFindsNoFeatures();
Expand Down