Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does it make sense to test controllers

I have a simple MVC application consisting of View->Controller->Service->Model.

My controllers are really skinny. All they do is call service method and populate the ModelAndView. Is it considered a good practice to unit tests controllers to make sure they set required properties in the ModelAndView while mocking the services completely?

like image 770
superpeer Avatar asked Apr 17 '12 18:04

superpeer


1 Answers

At some point it would not harm to test even controllers - then you would be sure that they are calling correct service methods, passing (modifying - if any needed) request parameters properly and returning correct ModelAndView.

like image 58
Laimoncijus Avatar answered Sep 23 '22 15:09

Laimoncijus