Document concurrency considerations for TestExecutionListener implementations
I've been looking at some documentations to see if there is any thread safety semantics to consider when implementing a org.junit.platform.launcher.TestExecutionListener. I haven't found any, so asking here.
More specifically, is there ever a case where the same instance of TestExecutionListener could get invoked by multiple threads (simultaneously), such that these implementations need to handle any thread safety issues? If so, is it only for certain methods or do all methods on that interface's implementation need to take into account this aspect? For example, in theory, I wouldn't expect more than one thread invoking the testPlanExecutionFinished method.
Good point, we should document that. testPlanExecutionStarted and testPlanExecutionFinished are always called from the same thread and it's safe to assume there's at most one TestPlan at a time (in theory, someone could call the Launcher concurrently but AFAIK no tool does that). All other method could be called from different threads concurrently in case one or multiple test engines execute tests in parallel.
@marcphilipp, thank you. That answer helps me decide how to go about one of the implementations in Apache Ant.
This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. Thank you for your contribution.
This issue has been automatically closed due to inactivity. If you have a good use case for this feature, please feel free to reopen the issue.
The proposed documentation change sounds useful to me, so I wonder if this issue should be re-opened?
I'd like to give this one a try. :)
Is updating the Javadoc on org.junit.platform.launcher.TestExecutionListener enough, or is there another guide to update as well?