Daily Archives: May 17, 2014

Unit Testing of Spring MVC Controllers

After all the services, DAO, and support classes are tested then it’s time for the controller. Generally, this is hard to test and most developers (based on observation) would rather just test it via Selenium or worse, by hand. That can work but it makes testing logic branches difficult and not to mention it’s time-consuming. Plus no active developer would be willing to wait for browser tests to run before checking in code. Luckily the Spring MVC Test project can do full controller testing via unit tests, it was such a success that it’s now in Spring MVC core as of version 4.0.5. Getting Ready We can get the required testing dependencies by adding the following dependency declarations to the…

Continue Reading
Contact Us
  • Nanyang Technological University, Singapore
  • root [at] haozhexie [dot] com