Skip to content

Commit a83fb13

Browse files
committed
Add Testing Improvements section to reference manual
1 parent a3a4344 commit a83fb13

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

src/asciidoc/index.adoc

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -783,9 +783,9 @@ Framework release.
783783

784784

785785
=== Removed Deprecated Packages and Methods
786-
All deprecated packages, and many deprecated classes and methods have been removed with
787-
version 4.0. If you are upgrading from a previous release of Spring, you should ensure
788-
that you have fixed any deprecated calls that you were making.
786+
All deprecated packages, and many deprecated classes, methods, and fields have been
787+
removed with version 4.0. If you are upgrading from a previous release of Spring, you
788+
should ensure that you have fixed any deprecated calls that you were making.
789789

790790
For a complete set of changes, check out the
791791
http://docs.spring.io/spring-framework/docs/3.2.4.RELEASE_to_4.0.0.RELEASE/[API
@@ -919,8 +919,26 @@ For more information consult the `GroovyBeanDefinitionReader`
919919
{javadoc-baseurl}/org/springframework/beans/factory/groovy/GroovyBeanDefinitionReader.html[Javadoc].
920920

921921

922+
=== Testing Improvements
923+
In addition to pruning of deprecated code within the `spring-test` module, Spring
924+
Framework 4.0 introduces several new features for use in unit and integration testing.
922925

923-
926+
* Almost all annotations in the `spring-test` module (e.g., `@ContextConfiguration`,
927+
`@WebAppConfiguration`, `@ContextHierarchy`, `@ActiveProfiles`, etc.) can now be used
928+
as <<beans-meta-annotations,meta-annotations>> to create custom _composed annotations_
929+
and reduce configuration duplication across tests.
930+
* Active bean definition profiles can now be resolved programmatically, simply by
931+
implementing a custom <<testcontext-ctx-management-env-profiles-ActiveProfilesResolver,`ActiveProfilesResolver`>>
932+
and registering it via the `resolver` attribute of `@ActiveProfiles`.
933+
* A new `SocketUtils` utility class has been introduced in the `spring-core` module
934+
which enables you to scan for free TCP & UDP server ports on localhost. This
935+
functionality is not specific to testing but can prove very useful when writing
936+
integration tests that require the use of sockets, for example tests that start
937+
an in-memory SMTP server, FTP server, Servlet container, etc.
938+
* As of Spring 4.0, the set of mocks in the `org.springframework.mock.web` package is
939+
now compatible with Servlet 3.0. Furthermore, several of the Servlet API mocks
940+
(e.g., `MockHttpServletRequest`, `MockServletContext`, etc.) have been updated with
941+
minor enhancements and improved configurability.
924942

925943

926944

@@ -17948,7 +17966,8 @@ should be active when loading an `ApplicationContext` for test classes.
1794817966
====
1794917967
`@ActiveProfiles` provides support for __inheriting__ active bean definition profiles
1795017968
declared by superclasses by default. It is also possible to resolve active bean
17951-
definition profiles programmatically by implementing a custom `ActiveProfilesResolver`
17969+
definition profiles programmatically by implementing a custom
17970+
<<testcontext-ctx-management-env-profiles-ActiveProfilesResolver,`ActiveProfilesResolver`>>
1795217971
and registering it via the `resolver` attribute of `@ActiveProfiles`.
1795317972
====
1795417973

@@ -19071,6 +19090,7 @@ disable the inheritance of active profiles.
1907119090
}
1907219091
----
1907319092

19093+
[[testcontext-ctx-management-env-profiles-ActiveProfilesResolver]]
1907419094
Furthermore, it is sometimes necessary to resolve active profiles for tests
1907519095
__programmatically__ instead of declaratively -- for example, based on:
1907619096

0 commit comments

Comments
 (0)