Uploaded image for project: 'Radiology Module'
  1. Radiology Module
  2. RAD-370

See if mockMvc can improve our controller tests

    XMLWordPrintable

    Details

    • Complexity:
      Undetermined

      Description

      org.springframework.test.web.servlet.MockMvc has a nice fluent API to test requests and their responses.

      We could use it for integration tests on the controllers (rest and "normal" ones).

      Setup test class extending BaseModuleWebContextSensitiveTest (since ConcextConfiguration is needed) + add annotation WebAppConfiguration as explained here http://www.baeldung.com/spring-webappconfiguration

      However on a quick try I get a FileNotFoundException since 'openmrs-module-radiology/omod/src/main/webapp/WEB-INF/view/module/legacyui/errorhandler.jsp' is missing. Obviously a jsp references files in the legacyui which are not there when running the test. Maybe the ViewResolver can be mocked so that jsps are not compiled, although it would be great to test this in its entirety.

        Gliffy Diagrams

          Attachments

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              teleivo Ivo Ulrich
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: