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
[TestNG] Fix concurrent modification of events (#1919)
When a TestNG suite with `parallel="methods"` is executed TestNG will invoke
all `@DataProvider` annotated methods. Because these data providers also emit
the `TestRunStarted` event this event is emitted twice concurrently. These
events collide in the `CanonicalOrderEventPublisher` resulting in a concurrent
modification that inserts a null element rather then either of the events.
By moving the start of the test execution to the constructor we ensure that
test execution is always started serially. Additionally this ensures that it is
impossible to emit a `TestRunFinished` event without also emitting a
`TestRunStarted` event.
This comes at the cost of starting the execution as soon as the `@BeforeClass`
method is invoked. This will result in some apparent overhead as `TestNG` is
still preparing for execution.
Fixes: #1917
0 commit comments