Skip to content

Commit 4a87980

Browse files
edyslimarcphilipp
authored andcommitted
Document concurrency for TestExecutionListener implementations
Add a note about concurrency considerations for `TestExecutionListener` implementations to this interface's Javadoc. Issue: #2539 Co-authored-by: Marc Philipp <[email protected]>
1 parent 43acc46 commit 4a87980

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

junit-platform-launcher/src/main/java/org/junit/platform/launcher/TestExecutionListener.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@
4646
* {@link #testPlanExecutionStarted(TestPlan)} and
4747
* {@link #testPlanExecutionFinished(TestPlan)}.
4848
*
49+
* <p>Note on concurrency: {@link #testPlanExecutionStarted(TestPlan)} and
50+
* {@link #testPlanExecutionFinished(TestPlan)} are always called from the same
51+
* thread. It is safe to assume that there is at most one {@code TestPlan}
52+
* instance at a time. All other methods could be called from different threads
53+
* concurrently in case one or multiple test engines execute tests in parallel.
54+
*
4955
* @since 1.0
5056
* @see Launcher
5157
* @see TestPlan
@@ -58,6 +64,8 @@ public interface TestExecutionListener {
5864
* Called when the execution of the {@link TestPlan} has started,
5965
* <em>before</em> any test has been executed.
6066
*
67+
* <p>Called from the same thread as {@link #testPlanExecutionFinished(TestPlan)}.
68+
*
6169
* @param testPlan describes the tree of tests about to be executed
6270
*/
6371
default void testPlanExecutionStarted(TestPlan testPlan) {
@@ -67,6 +75,8 @@ default void testPlanExecutionStarted(TestPlan testPlan) {
6775
* Called when the execution of the {@link TestPlan} has finished,
6876
* <em>after</em> all tests have been executed.
6977
*
78+
* <p>Called from the same thread as {@link #testPlanExecutionStarted(TestPlan)}.
79+
*
7080
* @param testPlan describes the tree of tests that have been executed
7181
*/
7282
default void testPlanExecutionFinished(TestPlan testPlan) {

0 commit comments

Comments
 (0)