Skip to content

Commit

Permalink
Add fireTestStarted/Finished for undefined/pending steps in strict mode
Browse files Browse the repository at this point in the history
The JUnitReporter should for each call to Result either call
fireTestIgnored, or call fireTestStarted and fireTestFinished on the
step notifier. In strict mode undefined and pending steps should be
treated as failed steps, so fireTestStarted and fireTestFinished should
be called on the step notifier.
  • Loading branch information
brasmusson committed Jan 11, 2014
1 parent 5df09f8 commit 76b3b57
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions junit/src/main/java/cucumber/runtime/junit/JUnitReporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ private boolean isPendingOrUndefined(Result result) {

private void addFailureOrIgnoreStep(Result result) {
if (strict) {
stepNotifier.fireTestStarted();
addFailure(result);
stepNotifier.fireTestFinished();
} else {
ignoredStep = true;
stepNotifier.fireTestIgnored();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ public void result_with_undefined_step_strict() {

jUnitReporter.result(Result.UNDEFINED);

verify(stepNotifier, times(0)).fireTestStarted();
verify(stepNotifier, times(0)).fireTestFinished();
verify(stepNotifier, times(1)).fireTestStarted();
verify(stepNotifier, times(1)).fireTestFinished();
verifyAddFailureWithPendingException(stepNotifier);
verifyAddFailureWithPendingException(executionUnitNotifier);
verify(stepNotifier, times(0)).fireTestIgnored();
Expand Down Expand Up @@ -121,8 +121,8 @@ public void result_with_pending_step_strict() {

jUnitReporter.result(result);

verify(stepNotifier, times(0)).fireTestStarted();
verify(stepNotifier, times(0)).fireTestFinished();
verify(stepNotifier, times(1)).fireTestStarted();
verify(stepNotifier, times(1)).fireTestFinished();
verifyAddFailureWithPendingException(stepNotifier);
verifyAddFailureWithPendingException(executionUnitNotifier);
verify(stepNotifier, times(0)).fireTestIgnored();
Expand Down

0 comments on commit 76b3b57

Please sign in to comment.