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

Cucumber junit 5 parallel execution No basse StepListerner when using remoteDriver #3037

Closed
GianniGiglio opened this issue Feb 1, 2023 · 5 comments

Comments

@GianniGiglio
Copy link
Contributor

GianniGiglio commented Feb 1, 2023

Running cucumber junit 5 test in parallel is work when using a local driver but fails when using a remote driver.

The reason is probably because the wrong eventBus is used in the class RemoteDriverProvider.

Current implementation:

https://github.com/serenity-bdd/serenity-core/blob/main/serenity-core/src/main/java/net/serenitybdd/core/webdriver/driverproviders/RemoteDriverProvider.java#L75

TestOutcome testOutcome = StepEventBus.getEventBus().getBaseStepListener().getCurrentTestOutcome();

In this case the baseStepListener will be null and throw the stacktrace below.

I might have a fix but am unable to test it since I don't seem to be able to build the master branch using gradle.

Possible solution:

    TestOutcome testOutcome =null;
        if (StepEventBus.getParallelEventBus().isBaseStepListenerRegistered()){
            testOutcome =StepEventBus.getParallelEventBus().getBaseStepListener().getCurrentTestOutcome();
        }else {

         testOutcome = StepEventBus.getEventBus().getBaseStepListener().getCurrentTestOutcome();

}

java.lang.Exception: Stack trace
at java.base/java.lang.Thread.dumpStack(Thread.java:1383)
at net.thucydides.core.steps.StepEventBus.getBaseStepListener(StepEventBus.java:194)
at net.serenitybdd.core.webdriver.driverproviders.RemoteDriverProvider.newInstance(RemoteDriverProvider.java:75)
at net.thucydides.core.webdriver.WebDriverFactory.createWebDriver(WebDriverFactory.java:162)
at net.thucydides.core.webdriver.WebDriverFactory.newWebdriverInstance(WebDriverFactory.java:140)
at net.thucydides.core.webdriver.WebDriverFacade.newDriverInstance(WebDriverFacade.java:158)
at net.thucydides.core.webdriver.WebDriverFacade.newProxyDriver(WebDriverFacade.java:149)
at net.thucydides.core.webdriver.WebDriverFacade.getProxiedDriver(WebDriverFacade.java:119)
at net.thucydides.core.webdriver.WebDriverFacade.get(WebDriverFacade.java:189)

@GianniGiglio
Copy link
Contributor Author

@cliviu Sorry to ping you but since you did some fixes for parellel execution perhaps you can have a look.

@cliviu
Copy link
Collaborator

cliviu commented Feb 2, 2023

Yes, is in my backlog. I will have a look over the weekend.

@GianniGiglio
Copy link
Contributor Author

Just letting you know I was able to test this locally by swapping the class. The proposed code fixes the issue

@GianniGiglio
Copy link
Contributor Author

Already opened a Pr since I was able to build using maven
#3040

wakaleo pushed a commit that referenced this issue Feb 3, 2023
* fix: serenity-cucumber-smoke-test gradle setup

* fix: serenity-cucumber-smoke-test gradle setup

* fix: cucumber parallel execution with remote driver

* fix: cucumber parallel execution with remote driver

* fix: cucumber parallel execution with remote driver
@wakaleo
Copy link
Member

wakaleo commented Feb 6, 2023

Should be fixed in 3.6.12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants