Book Image

Spring MVC: Beginner's Guide - Second Edition

By : Amuthan Ganeshan
Book Image

Spring MVC: Beginner's Guide - Second Edition

By: Amuthan Ganeshan

Overview of this book

Spring MVC helps you build flexible and loosely coupled web applications. The Spring MVC Framework is architected and designed in such a way that every piece of logic and functionality is highly configurable. Also, Spring can integrate effortlessly with other popular web frameworks such as Struts, WebWork, Java Server Faces, and Tapestry. The book progressively teaches you to configure the Spring development environment, architecture, controllers, libraries, and more before moving on to developing a full web application. It begins with an introduction to the Spring development environment and architecture so you're familiar with the know-hows. From here, we move on to controllers, views, validations, Spring Tag libraries, and more. Finally, we integrate it all together to develop a web application. You'll also get to grips with testing applications for reliability.
Table of Contents (20 chapters)
Spring MVC Beginner's Guide - Second Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

Integration testing with the Spring Test context framework


When individual program units are combined and tested as a group, then it is known as integration testing. The Spring Test context framework provides first-class support for an integration test of a Spring-based application. We have defined lots of Spring managed beans in our web application context, such as services, repositories, view resolvers, and more, to run our application.

These managed beans are instantiated during the startup of an application by the Spring framework. While doing the integration testing, our test environment must also have those beans to test our application successfully. The Spring Test context framework gives us the ability to define a test context that is similar to the web application context. Let's see how to incorporate the Spring Test context to test our ProductValidator class.

Time for action - testing product validator

Let's see how we can boot up our test context using the Spring Test context framework...