Skip to content

Commit

Permalink
possible fix for #3546 (#3589)
Browse files Browse the repository at this point in the history
* #possible fix for #3546

* improve logging

* expose result
  • Loading branch information
cliviu authored Dec 22, 2024
1 parent 5af870d commit 305ab6a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package io.cucumber.core.plugin;


import io.cucumber.plugin.event.Status;
import net.serenitybdd.cucumber.events.StepFinishedWithResultEvent;
import net.serenitybdd.model.exceptions.SerenityManagedException;
import net.thucydides.core.steps.events.StepEventBusEvent;
import io.cucumber.messages.types.Scenario;
Expand Down Expand Up @@ -337,6 +339,12 @@ public void addHighPriorityStepEventBusEvent(String scenarioId, StepEventBusEven

public void addStepEventBusEvent(StepEventBusEvent event) {
if (TestSession.isSessionStarted()) {
if (event instanceof StepFinishedWithResultEvent) {
if (Status.FAILED.equals(((StepFinishedWithResultEvent) event).getResult().getStatus()) && TestSession.currentStepHasFailed()) {
LOGGER.debug("SRP:ignored event " + event + " " + Thread.currentThread() + " because current Step has already failed");
return;
}
}
TestSession.addEvent(event);
event.setStepEventBus(stepEventBus);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void play() {


private void failed(String stepTitle, Throwable cause, List<ScreenshotAndHtmlSource> screenshots) {
if (!errorOrFailureRecordedForStep(stepTitle, cause)) {
if (!errorOrFailureRecordedForStep(stepTitle, cause)) {
if (!isEmpty(stepTitle)) {
getStepEventBus().updateCurrentStepTitle(stepTitle);
}
Expand Down Expand Up @@ -141,4 +141,11 @@ private String currentStepTitle() {
? getStepEventBus().getCurrentStep().get().getDescription() : "";
}

public Result getResult() {
return result;
}

public String toString() {
return("EventBusEvent STEP_FINISHED_WITH_RESULT with result " + result);
}
}

0 comments on commit 305ab6a

Please sign in to comment.