Sam Brannen opened SPR-15735 and commented

Status Quo

The test instance is not supplied to TestContextManager.beforeTestClass() and TestContextManager.afterTestClass(). Consequently, the beforeTestClass() and afterTestClass() methods of TestExecutionListener implementations never have access to the test instance.

For JUnit 4, it is a moot point since the test instance is never available for class-level callbacks (due to per-method test instance lifecycle semantics). However, for TestNG the test instance is always available, and in JUnit Jupiter the test instance is available if the test class is annotated with @TestInstance(Lifecycle.PER_CLASS).

Deliverables

  1. Introduce overloaded variants of TestContextManager.beforeTestClass() and TestContextManager.afterTestClass() that accept an Object testInstance parameter and use it to update the state of the managed TestContext.
  2. Consider providing access to container-level exceptions as well (potentially in a separate issue).

Comment From: sbrannen

Closing due to lack of interest.