Overview
The Javadoc for all "after" callback methods in TestContextManager (such as afterTestExecution()) states the following.
Note that listeners will be executed in the opposite order in which they were registered.
However, most developers would not logically think to read the Javadoc for TestContextManager when trying to reason about TestExecutionListener callbacks.
Therefore, as mentioned by @nizametdinovcrx in #34225 (comment), we should officially document the "wrapping behavior" of TestExecutionListener callbacks, especially with regard to the fact that "after" callbacks are invoked in reverse registration order.
Since I authored the documentation for JUnit Jupiter's Wrapping Behavior of Callbacks, I will likely borrow from that.
Related Issues
Overview
The Javadoc for all "after" callback methods in
TestContextManager(such as afterTestExecution()) states the following.However, most developers would not logically think to read the Javadoc for
TestContextManagerwhen trying to reason aboutTestExecutionListenercallbacks.Therefore, as mentioned by @nizametdinovcrx in #34225 (comment), we should officially document the "wrapping behavior" of
TestExecutionListenercallbacks, especially with regard to the fact that "after" callbacks are invoked in reverse registration order.Since I authored the documentation for JUnit Jupiter's Wrapping Behavior of Callbacks, I will likely borrow from that.
Related Issues
DirtiesContextTestExecutionListenerhas unexpected execution order leading to errors #34225