apache / apache/groovy-geb

Geb's reporting is not thread safe

Open
#201 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Groovy
Stars
1.2k
Forks
235
PR merge metrics
No merged PRs in 30d

Description

Geb's reporting is not thread safe.

This assumption is documented at the top of GebTestManager.groovy:
```
/**
* This implementation assumes that a thread is reserved for one test execution at least from
* {@code beforeTest} until {@code afterTest}, and that {@code beforeTestClass} and {@code afterTestClass}
* are called on the same thread, even if the thread executed some test inbetween.
* There should also only be one instance for all tests of a class even if run in parallel.
*/
```

however that assumption appears to be incorrect for the default execution mode of parallel specs + parallel features (see [Spock Documentation](https://spockframework.org/spock/docs/2.4-M4/parallel_execution.html#execution-modes)).

The end result is probably going to be that reports end up in the wrong directory (through a chain of ThreadLocals eventually ending up at Browser's `reportGroup` property). However, in the event that feature methods in different specs running in parallel happen to have the same name (which is the case for Geb's failing ParallelExecutionSpec) then not only do files get written into the wrong directory, but because the filenames collide then they end up overwriting each other.

Contributor guide

Open the contributing guide

Research direction

Read the thread-safety assumption in GebTestManager.groovy and inspect the failing ParallelExecutionSpec, following the ThreadLocals and Browser reportGroup path described in the issue. Done means parallel specs and features place reports in the correct directories without same-named feature files overwriting one another; run ParallelExecutionSpec to verify.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.