org.springframework.test.context
Interface TestExecutionListener

All Known Implementing Classes:
AbstractTestExecutionListener, DependencyInjectionTestExecutionListener, DirtiesContextTestExecutionListener, TransactionalTestExecutionListener

public interface TestExecutionListener

TestExecutionListener defines a listener API for reacting to test execution events published by the TestContextManager with which the listener is registered.

Concrete implementations must provide a public no-args constructor, so that listeners can be instantiated transparently by tools and configuration mechanisms.

Spring provides the following out-of-the-box implementations:

Since:
2.5
Author:
Sam Brannen, Juergen Hoeller

Method Summary
 void afterTestMethod(TestContext testContext)
          Post-processes a test just after execution of the test method in the supplied test context, for example for tearing down test fixtures.
 void beforeTestMethod(TestContext testContext)
          Pre-processes a test just before execution of the test method in the supplied test context, for example for setting up test fixtures.
 void prepareTestInstance(TestContext testContext)
          Prepares the test instance of the supplied test context, for example for injecting dependencies.
 

Method Detail

prepareTestInstance

void prepareTestInstance(TestContext testContext)
                         throws Exception
Prepares the test instance of the supplied test context, for example for injecting dependencies.

This method should be called immediately after instantiation but prior to any framework-specific lifecycle callbacks.

Parameters:
testContext - the test context for the test (never null)
Throws:
Exception - allows any exception to propagate

beforeTestMethod

void beforeTestMethod(TestContext testContext)
                      throws Exception
Pre-processes a test just before execution of the test method in the supplied test context, for example for setting up test fixtures.

Parameters:
testContext - the test context in which the test method will be executed (never null)
Throws:
Exception - allows any exception to propagate

afterTestMethod

void afterTestMethod(TestContext testContext)
                     throws Exception
Post-processes a test just after execution of the test method in the supplied test context, for example for tearing down test fixtures.

Parameters:
testContext - the test context in which the test method was executed (never null)
Throws:
Exception - allows any exception to propagate


Copyright © 2002-2008 The Spring Framework.