This is an automated email from the ASF dual-hosted git repository.

jonnybot pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy-geb.git


The following commit(s) were added to refs/heads/master by this push:
     new 343319c8 Fix a race-condition in reporting with parallel execution
343319c8 is described below

commit 343319c860efc5267b9b424c09c741cdcff95a83
Author: Björn Kautler <[email protected]>
AuthorDate: Thu Apr 24 18:23:10 2025 +0200

    Fix a race-condition in reporting with parallel execution
---
 module/geb-core/src/main/groovy/geb/test/GebTestManager.groovy | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/module/geb-core/src/main/groovy/geb/test/GebTestManager.groovy 
b/module/geb-core/src/main/groovy/geb/test/GebTestManager.groovy
index 30b46184..9693770f 100644
--- a/module/geb-core/src/main/groovy/geb/test/GebTestManager.groovy
+++ b/module/geb-core/src/main/groovy/geb/test/GebTestManager.groovy
@@ -97,6 +97,11 @@ class GebTestManager {
         this.testClass.get().push(testClass)
         currentTestName.set(testName)
         if (reportingEnabled) {
+            // it happens that beforeTestClass for test class A is run on a 
thread
+            // and next beforeTest (and thus test execution) for tests from 
class B are run on that thread
+            // as the browser is thread-local reused, we need to set the 
report group here or the report
+            // eventually is written to the wrong report group which is 
confusing and makes some tests flaky
+            getBrowser().reportGroup(testClass)
             testCounter.get().push(nextTestCounter(testClass))
             perTestReportCounter.get().push(1)
         }

Reply via email to