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
sbt provides an API to register test event listeners which help better understand test execution. At the moment, it's impossible to rely on the timing of these events, because:
they're not passed on to the listeners at the time they're emitted
startGroup and endGroup events are received by listeners at different times depending on whether the tests run in-process or in a forked JVM.
What I'd like to do
I would like to fix this by:
changing the in-process test runner so that events are immediately sent to the listeners as they're produced by the test frameworks.
slightly change the communication protocol between sbt and the forked JVM:
introduce new StartGroup and EndGroup messages, which sbt will map to the eponymous events of the test listeners.
send test events immediately as they're produced by the test frameworks.
Increase the priority of the thread reading messages from the forked JVM, so that they're handled as early as possible.
No API changes are envisioned for this work.
Benefits
This change will make it possible to measure how much time is spent doing test class setup and cleanup. Currently, it's not possible to get this information, because the startGroup, testEvent and endGroup callbacks are called together and their payloads don't contain this information.
Limitations
The test events have no timestamp, so it's impossible for test events listeners to know accurately when an event was emitted. The proposed changes improves the situation, but the results cannot be 100% accurate. It'd be good to look into this for sbt 2.
Current situation
sbt provides an API to register test event listeners which help better understand test execution. At the moment, it's impossible to rely on the timing of these events, because:
startGroup
andendGroup
events are received by listeners at different times depending on whether the tests run in-process or in a forked JVM.What I'd like to do
I would like to fix this by:
StartGroup
andEndGroup
messages, which sbt will map to the eponymous events of the test listeners.No API changes are envisioned for this work.
Benefits
This change will make it possible to measure how much time is spent doing test class setup and cleanup. Currently, it's not possible to get this information, because the
startGroup
,testEvent
andendGroup
callbacks are called together and their payloads don't contain this information.Limitations
The test events have no timestamp, so it's impossible for test events listeners to know accurately when an event was emitted. The proposed changes improves the situation, but the results cannot be 100% accurate. It'd be good to look into this for sbt 2.
Details of current implementation
When forking
sbt/testing/agent/src/main/java/sbt/ForkMain.java
Lines 407 to 412 in fb8ca26
sbt/testing/agent/src/main/java/sbt/ForkMain.java
Line 438 in fb8ca26
startGroup
,testEvent
andendGroup
events all together:sbt/main-actions/src/main/scala/sbt/ForkTests.scala
Lines 215 to 221 in fb8ca26
When running in-process
sbt/testing/src/main/scala/sbt/TestFramework.scala
Lines 166 to 170 in fb8ca26
The text was updated successfully, but these errors were encountered: