You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
1.6 KiB
29 lines
1.6 KiB
2 years ago
|
[[webmvc.test]]
|
||
7 years ago
|
= Testing
|
||
2 years ago
|
[.small]#<<web-reactive.adoc#webflux-test, See equivalent in the Reactive stack>>#
|
||
7 years ago
|
|
||
7 years ago
|
This section summarizes the options available in `spring-test` for Spring MVC applications.
|
||
7 years ago
|
|
||
6 years ago
|
* Servlet API Mocks: Mock implementations of Servlet API contracts for unit testing controllers,
|
||
|
filters, and other web components. See <<testing.adoc#mock-objects-servlet, Servlet API>>
|
||
|
mock objects for more details.
|
||
7 years ago
|
|
||
6 years ago
|
* TestContext Framework: Support for loading Spring configuration in JUnit and TestNG tests,
|
||
|
including efficient caching of the loaded configuration across test methods and support for
|
||
|
loading a `WebApplicationContext` with a `MockServletContext`.
|
||
7 years ago
|
See <<testing.adoc#testcontext-framework,TestContext Framework>> for more details.
|
||
|
|
||
6 years ago
|
* Spring MVC Test: A framework, also known as `MockMvc`, for testing annotated controllers
|
||
|
through the `DispatcherServlet` (that is, supporting annotations), complete with the
|
||
|
Spring MVC infrastructure but without an HTTP server.
|
||
|
See <<testing.adoc#spring-mvc-test-framework, Spring MVC Test>> for more details.
|
||
7 years ago
|
|
||
6 years ago
|
* Client-side REST: `spring-test` provides a `MockRestServiceServer` that you can use as
|
||
|
a mock server for testing client-side code that internally uses the `RestTemplate`.
|
||
|
See <<testing.adoc#spring-mvc-test-client, Client REST Tests>> for more details.
|
||
7 years ago
|
|
||
6 years ago
|
* `WebTestClient`: Built for testing WebFlux applications, but it can also be used for
|
||
7 years ago
|
end-to-end integration testing, to any server, over an HTTP connection. It is a
|
||
6 years ago
|
non-blocking, reactive client and is well suited for testing asynchronous and streaming
|
||
2 years ago
|
scenarios. See <<testing.adoc#webtestclient, `WebTestClient`>> for more details.
|