Spring MVC Test Tutorial

Superhero Blasting OffDo you want to learn an easy way to write tests for Spring MVC applications?

If you are working with Spring MVC, I can guarantee that the answer to this question is yes. Automated tests saves you time, money and a lot of headache. And yet, writing comprehensive tests for Spring MVC controllers has been a complex task. The problem is that if a task is complex, time consuming and it is not absolutely necessary, you are less likely to finish it. That is how we humans work.

I have spend countless hours of writing tests to Spring MVC applications and the results were still mediocre at best. I knew that important areas of my applications were left untested but that was a compromise I had to make. If you have tried writing tests to Spring MVC applications, I am sure that you know what I am talking about here.

The Spring MVC Test framework solves these problems. Lets move on and find out how the Spring MVC Test framework helps us to do a better job.

Introducing: Integration Testing of Spring MVC Applications

This eight-part tutorial teaches you everything you need to know about Spring Test MVC (aka spring-test-mvc).

Even though this tutorial concentrates on integration testing of Spring MVC applications, you can easily adapt its lessons to unit testing as well. All you have to do is to replace the service implementation with a mock and you are ready to go.

Also, you can use the lessons learned for writing tests to applications which are using Spring Framework 3.1 or 3.2.

Enough with smalltalk. Each part of this tutorial is described in the following:

Congratulations. You have now taken the first and very important step of a long journey. Your next step is to put the lessons learned into action. Don’t just think about doing it when you have time to do it. Do it right now.

P.S. If you liked my Spring MVC Test tutorial, take a look at my Spring Data book.