XMLWordPrintable

Details

    • Epic
    • Status: Ready for Work
    • Could
    • Resolution: Unresolved
    • None
    • None
    • None
    • None
    • High
    • End to End Tests for FHIR2
    • To Do

    Description

      FHIR2 has what we've been calling "integration" tests, though they don't actually test things in a full OpenMRS instance, but rather in the context of the OpenMRS BaseModuleContextSensitiveTest. While this is sufficient for many use-cases for showing that the FHIR2 module can work with the OpenMRS data model, etc. and is very convenient, it does mean that our integration tests aren't really testing on an integrated system and this had lead to us missing some bugs.

      Most of our integration tests can be found here and look something like this:

      @Test
      public void shouldReturnExistingPersonAsJson() throws Exception {
      	MockHttpServletResponse response = get("/Person/" + PERSON_UUID).accept(FhirMediaTypes.JSON).go();
      	
      	assertThat(response, isOk());
      	assertThat(response.getContentType(), is(FhirMediaTypes.JSON.toString()));
      	assertThat(response.getContentAsString(), notNullValue());
      	
      	Person person = readResponse(response);
      	
      	assertThat(person, notNullValue());
      	assertThat(person.getIdElement().getIdPart(), equalTo(PERSON_UUID));
      	assertThat(person, validResource());
      }
      

      As can be seen, we're using Spring's MockHttpServletResponse (and MockHttpServletRequest to send requests and responses.

      Instead, it would be great to have proper integration tests that:

      1. Spin up an instance of OpenMRS with some demo data
      2. Run at least one test for each operation (Create, Read, Update, and Delete) for each resource and ensure the test passes as expected

      This will hopefully help us catch bugs and programming errors.

      Gliffy Diagrams

        Attachments

          Activity

            People

              jnsereko Joshua Nsereko
              ibacher Ian Bacher
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: