You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Background:
I know this isn't an officially supported way of running serenity with cucumber tests but for our project (fully containerized tests) we use a custom implementation where we run the test directly using a main method (no junit). Doing so we use the cucumber jvm feature to run multithreaded on scenario level instead of feature file. Up until version 2.4.4 everything works fine.
Using a higher version of the serenity gives the following error:
java.util.EmptyStackException
at java.util.Stack.peek(Stack.java:102)
at net.thucydides.core.steps.BaseStepListener.getCurrentStep(BaseStepListener.java:753)
at net.thucydides.core.steps.BaseStepListener.currentStepHasMoreThanOneScreenshot(BaseStepListener.java:991)
at net.thucydides.core.steps.BaseStepListener.removeDuplicatedInitalScreenshotsIfPresent(BaseStepListener.java:977)
at net.thucydides.core.steps.BaseStepListener.take(BaseStepListener.java:954)
at net.thucydides.core.steps.BaseStepListener.takeEndOfStepScreenshotFor(BaseStepListener.java:932)
at net.thucydides.core.steps.BaseStepListener.stepFinished(BaseStepListener.java:781)
at net.thucydides.core.steps.StepEventBus.stepFinished(StepEventBus.java:446)
at net.thucydides.core.steps.StepInterceptor.notifyStepFinishedFor(StepInterceptor.java:515)
at net.thucydides.core.steps.StepInterceptor.executeTestStepMethod(StepInterceptor.java:485)
at net.thucydides.core.steps.StepInterceptor.runTestStep(StepInterceptor.java:458)
at net.thucydides.core.steps.StepInterceptor.runOrSkipMethod(StepInterceptor.java:210)
at net.thucydides.core.steps.StepInterceptor.testStepResult(StepInterceptor.java:197)
at net.thucydides.core.steps.StepInterceptor.intercept(StepInterceptor.java:85)
at net.thucydides.core.steps.ProxyConfiguration$InterceptorDispatcher.intercept(ProxyConfiguration.java:51)
The exception is throw when the screenshot is taken however even when disabling the screenshots the reports are generated completely wrong and steps are mixed in the reports.
I was able to track the change causing the issue 0690c0f
private final ThreadLocal<Stack> currentStepStack;
private final Stack currentStepStack = new Stack<>();
It's likely caused because baseSteplListner is not thread-safe anymore since ThreadLocal is not used anymore for the stack.
The text was updated successfully, but these errors were encountered:
GianniGiglio
changed the title
Running tests multithreaded using cucumber scenario paralleliszation is broke
Running tests multithreaded using cucumber scenario paralleliszation is broken
Sep 6, 2021
@wakaleo I know it's not supported but seeing you left the ThreadLocal currentStepStack commented out, it felt like the implementation was still unsure.
Pitty since it worked using thread-local but I understand.
It would be great if in the future you decide to support this, it would definitely improve the test execution time and memory consumption since no forks are used and you get a better distribution of the scenario's accross all threads.
Hi,
Background:
I know this isn't an officially supported way of running serenity with cucumber tests but for our project (fully containerized tests) we use a custom implementation where we run the test directly using a main method (no junit). Doing so we use the cucumber jvm feature to run multithreaded on scenario level instead of feature file. Up until version 2.4.4 everything works fine.
Using a higher version of the serenity gives the following error:
java.util.EmptyStackException
at java.util.Stack.peek(Stack.java:102)
at net.thucydides.core.steps.BaseStepListener.getCurrentStep(BaseStepListener.java:753)
at net.thucydides.core.steps.BaseStepListener.currentStepHasMoreThanOneScreenshot(BaseStepListener.java:991)
at net.thucydides.core.steps.BaseStepListener.removeDuplicatedInitalScreenshotsIfPresent(BaseStepListener.java:977)
at net.thucydides.core.steps.BaseStepListener.take(BaseStepListener.java:954)
at net.thucydides.core.steps.BaseStepListener.takeEndOfStepScreenshotFor(BaseStepListener.java:932)
at net.thucydides.core.steps.BaseStepListener.stepFinished(BaseStepListener.java:781)
at net.thucydides.core.steps.StepEventBus.stepFinished(StepEventBus.java:446)
at net.thucydides.core.steps.StepInterceptor.notifyStepFinishedFor(StepInterceptor.java:515)
at net.thucydides.core.steps.StepInterceptor.executeTestStepMethod(StepInterceptor.java:485)
at net.thucydides.core.steps.StepInterceptor.runTestStep(StepInterceptor.java:458)
at net.thucydides.core.steps.StepInterceptor.runOrSkipMethod(StepInterceptor.java:210)
at net.thucydides.core.steps.StepInterceptor.testStepResult(StepInterceptor.java:197)
at net.thucydides.core.steps.StepInterceptor.intercept(StepInterceptor.java:85)
at net.thucydides.core.steps.ProxyConfiguration$InterceptorDispatcher.intercept(ProxyConfiguration.java:51)
The exception is throw when the screenshot is taken however even when disabling the screenshots the reports are generated completely wrong and steps are mixed in the reports.
I was able to track the change causing the issue 0690c0f
More precisly 0690c0f#diff-2b4bcdac67f1a12b80c7bc0cf08736cdef4e53fdfe8f03447fcab71742d2435fR73
private final ThreadLocal<Stack> currentStepStack;
private final Stack currentStepStack = new Stack<>();
It's likely caused because baseSteplListner is not thread-safe anymore since ThreadLocal is not used anymore for the stack.
The text was updated successfully, but these errors were encountered: