|
2 | 2 | = Testing |
3 | 3 | [.small]#<<web-reactive.adoc#webflux-test,Same in Spring WebFlux>># |
4 | 4 |
|
| 5 | +This section summarizes the options available in `spring-test` for Spring MVC applications. |
5 | 6 |
|
| 7 | +**Servlet API Mocks** |
6 | 8 |
|
| 9 | +Mock implementations of Servlet API contracts for unit testing controllers, filters, and |
| 10 | +other web components. See <<testing.adoc#mock-objects-servlet,Servlet API>> mock objects |
| 11 | +for more details. |
7 | 12 |
|
8 | | -[[testing-servlet-mocks]] |
9 | | -== Servlet API Mocks |
| 13 | +**TestContext Framework** |
10 | 14 |
|
11 | | -`spring-test` provides mock implementations of Servlet API contracts for unit testing |
12 | | -controllers, filters, and other web components. |
13 | | -See <<testing.adoc#mock-objects-servlet,Servlet API>> mock objects for more details. |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
18 | | -[[testing-testcontext]] |
19 | | -== TestContext Framework |
20 | | - |
21 | | -`spring-test` provides support for loading Spring configuration in JUnit and TestNG tests |
22 | | -including efficient caching of the loaded configuration across test methods and support for |
23 | | -loading a `WebApplicationContext` with a `MockServletContext`. |
| 15 | +Support for loading Spring configuration in JUnit and TestNG tests including efficient |
| 16 | +caching of the loaded configuration across test methods and support for loading a |
| 17 | +`WebApplicationContext` with a `MockServletContext`. |
24 | 18 | See <<testing.adoc#testcontext-framework,TestContext Framework>> for more details. |
25 | 19 |
|
| 20 | +**Spring MVC Test** |
26 | 21 |
|
27 | | - |
28 | | - |
29 | | -[[testing-mockmvc]] |
30 | | -== Spring MVC Test (MockMvc) |
31 | | - |
32 | | -`spring-test` provides a framework for testing annotated controllers through the |
| 22 | +A framework, also known as `MockMvc`, for testing annotated controllers through the |
33 | 23 | `DispatcherServlet`, i.e. supporting annotations and complete with Spring MVC |
34 | | -infrastructure, but without an HTTP server. |
35 | | -See <<testing.adoc#spring-mvc-test-framework,Spring MVC Test>> for more details. |
36 | | - |
37 | | - |
38 | | - |
| 24 | +infrastructure, but without an HTTP server. See |
| 25 | +<<testing.adoc#spring-mvc-test-framework,Spring MVC Test>> for more details. |
39 | 26 |
|
40 | | -[[testing-resttemplate]] |
41 | | -== Client-side REST |
| 27 | +**Client-side REST** |
42 | 28 |
|
43 | 29 | `spring-test` provides a `MockRestServiceServer` that can be used as a mock server for |
44 | 30 | testing client-side code that internally uses the `RestTemplate`. |
45 | 31 | See <<testing.adoc#spring-mvc-test-client,Client REST Tests>> for more details. |
46 | 32 |
|
| 33 | +**WebTestClient** |
47 | 34 |
|
48 | | - |
49 | | - |
50 | | -[[testing-webtestclient]] |
51 | | -== WebTestClient |
52 | | - |
53 | | -`spring-test` provides a dedicated `WebTestClient` for end-to-end integration testing. |
54 | | -`WebTestClient` can connect to any server over an HTTP connection. It is non-blocking, |
55 | | -reactive client and well suited for testing asynchronous and streaming scenarios. |
| 35 | +`WebTestClient` was built for testing WebFlux applications but it can also be used for |
| 36 | +end-to-end integration testing, to any server, over an HTTP connection. It is a |
| 37 | +non-blocking, reactive client and well suited for testing asynchronous and streaming |
| 38 | +scenarios. |
0 commit comments