Package org.springframework.test.context
@NonNullApi
@NonNullFields
package org.springframework.test.context
This package contains the Spring TestContext Framework which
provides annotation-driven unit and integration testing support that is
agnostic of the actual testing framework in use. The same techniques and
annotation-based configuration used in, for example, a JUnit environment
can also be applied to tests written with TestNG, etc.
In addition to providing generic and extensible testing infrastructure, the Spring TestContext Framework provides out-of-the-box support for Spring-specific integration testing functionality such as context management and caching, dependency injection of test fixtures, and transactional test management with default rollback semantics.
-
ClassDescription
ActiveProfiles
is a class-level annotation that is used to declare which active bean definition profiles should be used when loading anApplicationContext
for test classes.Strategy interface for programmatically resolving which active bean definition profiles should be used when loading anApplicationContext
for a test class.BootstrapContext
encapsulates the context in which the Spring TestContext Framework is bootstrapped.@BootstrapWith
defines class-level metadata that is used to determine how to bootstrap the Spring TestContext Framework.ACacheAwareContextLoaderDelegate
is responsible for loading and closing application contexts, interacting transparently with aContextCache
behind the scenes.@ContextConfiguration
defines class-level metadata that is used to determine how to load and configure anApplicationContext
for integration tests.ContextConfigurationAttributes
encapsulates the context configuration attributes declared via@ContextConfiguration
.Strategy interface for customizingapplication contexts
that are created and managed by the Spring TestContext Framework.Factory for creatingContextCustomizers
.@ContextHierarchy
is a class-level annotation that is used to define a hierarchy ofApplicationContexts
for integration tests.Strategy interface for loading anapplication context
for an integration test managed by the Spring TestContext Framework.Registry used with@DynamicPropertySource
methods so that they can add properties to theEnvironment
that have dynamically resolved values.Method-level annotation for integration tests that need to add properties with dynamic values to theEnvironment
's set ofPropertySources
.MergedContextConfiguration
encapsulates the merged context configuration declared on a test class and all of its superclasses via@ContextConfiguration
,@ActiveProfiles
, and@TestPropertySource
.@NestedTestConfiguration
is a type-level annotation that is used to configure how Spring test configuration annotations are processed within enclosing class hierarchies (i.e., for inner test classes).Enumeration of modes that dictate how test configuration from enclosing classes is processed for inner test classes.Strategy interface for loading anapplication context
for an integration test managed by the Spring TestContext Framework.@TestConstructor
is a type-level annotation that is used to configure how the parameters of a test class constructor are autowired from components in the test'sApplicationContext
.Defines autowiring modes for parameters in a test constructor.TestContext
encapsulates the context in which a test is executed, agnostic of the actual testing framework in use.TestContextAnnotationUtils
is a collection of utility methods that complements the standard support already available inAnnotationUtils
andAnnotatedElementUtils
, while transparently honoring@NestedTestConfiguration
semantics.Descriptor for anAnnotation
, including the class on which the annotation is declared as well as the merged annotation instance.Untyped extension ofTestContextAnnotationUtils.AnnotationDescriptor
that is used to describe the declaration of one of several candidate annotation types where the actual annotation type cannot be predetermined.TestContextBootstrapper
defines the SPI for bootstrapping the Spring TestContext Framework.TestContextManager
is the main entry point into the Spring TestContext Framework.TestExecutionListener
defines a listener API for reacting to test execution events published by theTestContextManager
with which the listener is registered.TestExecutionListeners
defines class-level metadata for configuring whichTestExecutionListeners
should be registered with aTestContextManager
.Enumeration of modes that dictate whether or not explicitly declared listeners are merged with the default listeners when@TestExecutionListeners
is declared on a class that does not inherit listeners from a superclass.@TestPropertySource
is a class-level annotation that is used to configure theTestPropertySource.locations()
of properties files and inlinedTestPropertySource.properties()
to be added to theEnvironment
's set ofPropertySources
for anApplicationContext
for integration tests.@TestPropertySources
is a container for one or more@TestPropertySource
declarations.