Announcement Announcement Module
No announcement yet.
Writing test for Spring Web Application Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Writing test for Spring Web Application

    Hi All,

    I have question on writing the test for my Spring web application. I have three layer in my coding - MVC controller, service and utility. MVC Controller simply call service layer to populate DTO for UI. Service layer call third party REST service to get data and use utility class to format data from REST service to DTO. Now I want to write a test for this application. I am thinking of writing two test classes for MVC controller and service class.

    Now my question is
    - My approach of writing two tests for MVC controller and service is OK? Or can i just write only one test class to test controller functionality?
    - I am planning to use Mockito on service layer test for it. Any reference for this will help too.


  • #2
    You can write tests for each layer separately
    After that you can develop integration tests which will test interaction of controller and service etc