About Roger Hughes
The first blog in this mini-series introduced the Spring MVC Test Framework and demonstrated its use in unit testing Spring MVC Controller classes as controllers rather then as POJOs. It’s now time to talk about using the framework for integration testing.
By ‘integration testing’ I mean loading the Spring context into the test environment so that the controller can work with its collaborators in ‘end to end’ tests.
Again, I’m going to write a test for the FacebookPostsController from my Spring Social Facebook project and the test will be, as you might expect, an integration test version of my FacebookPostsControllerTest class. If you need to see the FacebookPostsController code or the original FacebookPostsControllerTestcode, take a look at my last blog. For a full run down on the FacebookPostsController code see the Spring Social Facebook blog.
The first step in creating an integration test is to load the Spring context into your test environment. This is done by adding the following annotations to the
Source : http://www.javacodegeeks.com/2013/07/getting-started-with-springs-mvc-test-framework-part-2.html