Book Image

Mastering Unit Testing Using Mockito and JUnit

By : Sujoy Acharya
Book Image

Mastering Unit Testing Using Mockito and JUnit

By: Sujoy Acharya

Overview of this book

Table of Contents (17 chapters)
Mastering Unit Testing Using Mockito and JUnit
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 7. Unit Testing the Web Tier

"If you don't like unit testing your product, most likely your customers won't like to test it either."

—Anonymous

Enterprise applications follow the N-tier architecture model to handle numerous nonfunctional concerns such as upgradability, scalability, and maintainability. The best design approach is to decouple the tiers from each other; this allows scaling out a tier without affecting another tier, or refactoring code in one tier without affecting the other tiers. Usually, any web application contains three tiers: presentation, business logic, and a database tier. This chapter deals with unit testing the web tier or presentation layer. The next chapters cover the application and database layers.

The following topics will be covered in this chapter:

  • Unit testing a servlet controller in MVC

  • Understanding what to test in the presentation layer