serenity-bdd / serenity-core

Serenity BDD is a test automation library designed to make writing automated acceptance tests easier, and more fun.
http://serenity-bdd.info
Other
718 stars 516 forks source link

With Serenity 4.1.14 test reporting to qtest fails with step listener error #3547

Open RemyaAnoop opened 1 day ago

RemyaAnoop commented 1 day ago

What happened?

Our project recently got updated to serenity 4.1.14 and when execute cucumber test, it fails with step listener error. I believe it’s due to cucumber and junit platform engine.

we have listener extending AbstractStepListener. Even directly implemented step listener. Issue is only with cucumber tests

I feel it’s coming from here : serenity-core/serenity-core/src/main/java/net/thucydides/core/steps/StepEventBus.java at c6553835fd88ec0267579339dae7d87bd8fc3d09 · serenity-bdd/serenity-core · GitHub

error :

11:53:36 [ERROR] 2024-09-25 13:53:35.957 29 StepEventBus - CurrentListener is null

11:53:36

11:53:36 CucumberTestSuite > Cucumber STANDARD_ERROR

11:53:36 java.lang.Exception: Stack trace

11:53:36 at java.base/java.lang.Thread.dumpStack(Thread.java:1380)

11:53:36 at net.thucydides.core.steps.StepEventBus.getBaseStepListener(StepEventBus.java:212)

11:53:36 at net.serenitybdd.core.reports.ReportDataSaver.doAddContents(ReportDataSaver.java:49)

11:53:36 at net.serenitybdd.core.reports.ReportDataSaver.addReportContent(ReportDataSaver.java:42)

11:53:36 at net.serenitybdd.core.reports.ReportDataSaver.andContents(ReportDataSaver.java:37)

11:53:36 at com.xxxx.automation.listeners.qTestRegressionListener.testFinished(qTestRegressionListener.java:40)

11:53:36 at net.thucydides.core.steps.StepEventBus.testFinished(StepEventBus.java:471)

11:53:36 at net.thucydides.core.steps.events.TestFinishedEvent.play(TestFinishedEvent.java:58)

11:53:36 at io.cucumber.core.plugin.ScenarioContextParallel.replayAllTestCaseEventsForLine(ScenarioContextParallel.java:401)

11:53:36 at io.cucumber.core.plugin.ScenarioContextParallel.playAllTestEvents(ScenarioContextParallel.java:367)

11:53:36 at io.cucumber.core.plugin.SerenityReporterParallel.handleTestRunFinished(SerenityReporterParallel.java:522)

11:53:36 at io.cucumber.core.eventbus.AbstractEventPublisher.send(AbstractEventPublisher.java:51)

11:53:36 at io.cucumber.core.eventbus.AbstractEventBus.send(AbstractEventBus.java:12)

11:53:36 at io.cucumber.core.runtime.SynchronizedEventBus.send(SynchronizedEventBus.java:47)

11:53:36 at io.cucumber.core.runtime.CucumberExecutionContext.emitTestRunFinished(CucumberExecutionContext.java:117)

11:53:36 at io.cucumber.core.runtime.CucumberExecutionContext.finishTestRun(CucumberExecutionContext.java:104)

11:53:36 at io.cucumber.junit.platform.engine.CucumberEngineExecutionContext.finishTestRun(CucumberEngineExecutionContext.java:126)

11:53:36 at io.cucumber.junit.platform.engine.CucumberEngineDescriptor.ifChildren(CucumberEngineDescriptor.java:63)

11:53:36 at io.cucumber.junit.platform.engine.CucumberEngineDescriptor.cleanUp(CucumberEngineDescriptor.java:48)

11:53:36 at io.cucumber.junit.platform.engine.CucumberEngineDescriptor.cleanUp(CucumberEngineDescriptor.java:12)

11:53:36 at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$cleanUp$10(NodeTestTask.java:167)

11:53:36 at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)

11:53:36 at org.junit.platform.engine.support.hierarchical.NodeTestTask.cleanUp(NodeTestTask.java:167)

11:53:36 at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:98)

11:53:36 at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService$ExclusiveTask.compute(ForkJoinPoolHierarchicalTestExecutorService.java:202)

11:53:36 at java.base/java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:194)

11:53:36 at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)

11:53:36 at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)

11:53:36 at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)

11:53:36 at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)

11:53:36 at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

11:53:36

**11:53:36 CucumberTestSuite > Cucumber STANDARD_OUT

11:53:36 [ERROR] 2024-09-25 13:53:35.958 29 qTestETRListener - Error submitting test results No BaseStepListener has been registered - are you running your test using the Serenity runners?

11:53:36 [ERROR] 2024-09-25 13:53:35.958 29 StepEventBus - CurrentListener is null**

11:53:36

What did you expect to happen?

Test should be successful with no issues

Serenity BDD version

4.1.14

JDK version

Java 17

Execution environment

Have multiple browsers , chrome 122 etc.

How to reproduce the bug.

Update build.gradle with 4.1.14 of serenity , gradle plugin 4.1.14 Cucumber junit platform engine: 7.16.1

We have a listener class which implements AbstractStepListener{ Which has override method for testFinished(TestOutcom result, Boolean isInDaraDrivenTesr, ZonedDatetime)

in this method we have qTestApPI object is called and do serenity.recordReportData().withTitle(“post test run status”)

}

The test failing in line recordReportData()

How can we make it happen?

Work on this myself and propose a PR (with Serenity BDD team guidance)

RemyaAnoop commented 1 day ago

@wakaleo or serenity team please help with this. it’s a blocker for us

wakaleo commented 1 day ago

Hi @RemyaAnoop sure, we can help take a look at that for you. Please take a look at the support options here: https://www.serenitydojo.academy/serenity-bdd-support-packages-page - once you decide the option that would work for you, you can get in touch using the form on the page or email me directly.

RemyaAnoop commented 1 day ago

@wakaleo our firm reached out to you for serenity dojo and support quote. Could you please share those information.

RemyaAnoop commented 1 day ago

Hi @RemyaAnoop sure, we can help take a look at that for you. Please take a look at the support options here: https://www.serenitydojo.academy/serenity-bdd-support-packages-page - once you decide the option that would work for you, you can get in touch using the form on the page or email me directly.

@wakaleo Since finalizing on the support option and dojo will be mostly from T3 and we need to release serenity 4 in 2 weeks, can you please provide some input on this issue?

wakaleo commented 1 day ago

Hi @RemyaAnoop sure, we can help take a look at that for you. Please take a look at the support options here: https://www.serenitydojo.academy/serenity-bdd-support-packages-page - once you decide the option that would work for you, you can get in touch using the form on the page or email me directly.

@wakaleo Since finalizing on the support option and dojo will be mostly from T3 and we need to release serenity 4 in 2 weeks, can you please provide some input on this issue?

Hi @RemyaAnoop, what is the name of your firm?

RemyaAnoop commented 1 day ago

@wakaleo please share your email. Will provide the details

wakaleo commented 20 hours ago

@wakaleo please share your email. Will provide the details

@RemyaAnoop john.smart[at]wakaleo.com