STU 3 Ballot

This page is part of the FHIR Specification (v1.6.0: STU 3 Ballot 4). The current version which supercedes this version is 5.0.0. For a full list of available versions, see the Directory of published versions

Testscript-example-multiserver.xml

Raw XML (canonical form)

Multiserver TestScript Example (id = "multiserver")

<TestScript xmlns="http://hl7.org/fhir">
  <id value="multiserver"/>
  <text><status value="generated"/><div xmlns="http://www.w3.org/1999/xhtml"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: multiserver</p><p><b>name</b>: Multiserver Test Script</p><p><b>description</b>: Multiserver Test Script</p><h3>Fixtures</h3><table><tr><td>-</td><td><b>Resource</b></td></tr><tr><td>*</td><td><a>Patient/patient-example.xml</a></td></tr></table><blockquote><p><b>setup</b></p><blockquote><p><b>action</b></p><h3>Operations</h3><table><tr><td>-</td><td><b>Type</b></td><td><b>ContentType</b></td><td><b>Destination</b></td><td><b>SourceId</b></td></tr><tr><td>*</td><td>create</td><td>xml</td><td>0</td><td>F1</td></tr></table></blockquote></blockquote><blockquote><p><b>test</b></p><p><b>name</b>: Read Patient</p><p><b>description</b>: Read the patient from server 0.</p><blockquote><p><b>metadata</b></p><h3>Links</h3><table><tr><td>-</td><td><b>Url</b></td><td><b>Description</b></td></tr><tr><td>*</td><td><a>http://hl7.org/implement/standards/FHIR-Develop/patient.html</a></td><td>FHIR Patient</td></tr></table><blockquote><p><b>operation</b></p><p><b>type</b>: create</p><p><b>resource</b>: Patient</p><p><b>description</b>: Patient Create Operation</p><p><b>link</b>: <a>http://hl7.org/implement/standards/FHIR-Develop/http.html#create</a></p><p><b>required</b>: true</p></blockquote><blockquote><p><b>operation</b></p><p><b>type</b>: read</p><p><b>resource</b>: Patient</p><p><b>description</b>: Patient Read Operation</p><p><b>link</b>: <a>http://hl7.org/implement/standards/FHIR-Develop/http.html#read</a></p><p><b>validated</b>: true</p></blockquote></blockquote><blockquote><p><b>action</b></p><h3>Operations</h3><table><tr><td>-</td></tr><tr><td>*</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table><tr><td>-</td></tr><tr><td>*</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table><tr><td>-</td></tr><tr><td>*</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table><tr><td>-</td></tr><tr><td>*</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table><tr><td>-</td></tr><tr><td>*</td></tr></table></blockquote></blockquote><blockquote><p><b>test</b></p><p><b>name</b>: Write Patient</p><p><b>description</b>: Write the patient read from server 0 to server 1.</p><blockquote><p><b>metadata</b></p><h3>Links</h3><table><tr><td>-</td><td><b>Url</b></td><td><b>Description</b></td></tr><tr><td>*</td><td><a>http://hl7.org/implement/standards/FHIR-Develop/patient.html</a></td><td>FHIR Patient</td></tr></table><blockquote><p><b>operation</b></p><p><b>type</b>: create</p><p><b>resource</b>: Patient</p><p><b>description</b>: Patient Create Operation</p><p><b>link</b>: <a>http://hl7.org/implement/standards/FHIR-Develop/http.html#create</a></p><p><b>required</b>: true</p></blockquote><blockquote><p><b>operation</b></p><p><b>type</b>: read</p><p><b>resource</b>: Patient</p><p><b>description</b>: Patient Read Operation</p><p><b>link</b>: <a>http://hl7.org/implement/standards/FHIR-Develop/http.html#read</a></p><p><b>validated</b>: true</p></blockquote></blockquote><blockquote><p><b>action</b></p><h3>Operations</h3><table><tr><td>-</td></tr><tr><td>*</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table><tr><td>-</td></tr><tr><td>*</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Operations</h3><table><tr><td>-</td></tr><tr><td>*</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table><tr><td>-</td></tr><tr><td>*</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table><tr><td>-</td></tr><tr><td>*</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table><tr><td>-</td></tr><tr><td>*</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table><tr><td>-</td></tr><tr><td>*</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table><tr><td>-</td></tr><tr><td>*</td></tr></table></blockquote></blockquote><blockquote><p><b>test</b></p><p><b>name</b>: Update Patient</p><p><b>description</b>: Update the patient on server 0 with the one read from server 1.</p><blockquote><p><b>metadata</b></p><h3>Links</h3><table><tr><td>-</td><td><b>Url</b></td><td><b>Description</b></td></tr><tr><td>*</td><td><a>http://hl7.org/implement/standards/FHIR-Develop/patient.html</a></td><td>FHIR Patient</td></tr></table><blockquote><p><b>operation</b></p><p><b>type</b>: create</p><p><b>resource</b>: Patient</p><p><b>description</b>: Patient Create Operation</p><p><b>link</b>: <a>http://hl7.org/implement/standards/FHIR-Develop/http.html#create</a></p><p><b>required</b>: true</p></blockquote><blockquote><p><b>operation</b></p><p><b>type</b>: read</p><p><b>resource</b>: Patient</p><p><b>description</b>: Patient Read Operation</p><p><b>link</b>: <a>http://hl7.org/implement/standards/FHIR-Develop/http.html#read</a></p><p><b>validated</b>: true</p></blockquote></blockquote><blockquote><p><b>action</b></p><h3>Operations</h3><table><tr><td>-</td></tr><tr><td>*</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table><tr><td>-</td></tr><tr><td>*</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Operations</h3><table><tr><td>-</td></tr><tr><td>*</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table><tr><td>-</td></tr><tr><td>*</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table><tr><td>-</td></tr><tr><td>*</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table><tr><td>-</td></tr><tr><td>*</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table><tr><td>-</td></tr><tr><td>*</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table><tr><td>-</td></tr><tr><td>*</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table><tr><td>-</td></tr><tr><td>*</td></tr></table></blockquote></blockquote><blockquote><p><b>teardown</b></p><blockquote><p><b>action</b></p><h3>Operations</h3><table><tr><td>-</td></tr><tr><td>*</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Operations</h3><table><tr><td>-</td></tr><tr><td>*</td></tr></table></blockquote></blockquote></div></text>
  <url value="http://hl7.org/fhir/TestScript/multiserver"/>
  <name value="Multiserver Test Script"/>
  <status value="draft"/>
  <description value="Multiserver Test Script"/>
  <origin>
    <index value="1"/>
    <profile>
      <code value="FHIR-Client"/>
    </profile>
  </origin>
  <destination>
    <index value="1"/>
    <profile>
      <code value="FHIR-Server"/>
    </profile>
  </destination>
  <metadata>
    <capability>
      <validated value="true"/>
      <description value="Patient Create Operation"/>
      <origin value="1"/>
      <destination value="1"/>
      <link value="http://hl7.org/implement/standards/FHIR-Develop/http.html#create"/>
      <conformance>
        <reference value="Conformance/example"/>
      </conformance>
    </capability>
    <capability>
      <validated value="true"/>
      <description value="Patient Read Operation"/>
      <link value="http://hl7.org/implement/standards/FHIR-Develop/http.html#read"/>
      <conformance>
        <reference value="Conformance/example"/>
      </conformance>
    </capability>
    <capability>
      <validated value="true"/>
      <description value="Patient Update Operation"/>
      <link value="http://hl7.org/implement/standards/FHIR-Develop/http.html#update"/>
      <conformance>
        <reference value="Conformance/example"/>
      </conformance>
    </capability>
  </metadata>
  <fixture id="F1">
    <resource>
      <reference value="Patient/example"/>
    </resource>
  </fixture>
  <setup>
    <action>
      <operation>
        <type>
          <code value="create"/>
        </type>
        <contentType value="xml"/>
        <destination value="0"/>
        <origin value="0"/>
        <sourceId value="F1"/>
      </operation>
    </action>
  </setup>
  <test id="READ01">
    <name value="Read Patient"/>
    <description value="Read the patient from server 0."/>
    <action>
      <operation>
        <!--     this operation reads the fixture "F1" from server-0 and maps the response to fixture
         "R1"     -->
        <type>
          <code value="read"/>
        </type>
        <destination value="0"/>
        <responseId value="R1"/>
        <targetId value="F1"/>
      </operation>
    </action>
    <action>
      <assert>
        <response value="okay"/>
      </assert>
    </action>
    <action>
      <assert>
        <headerField value="Last-Modified"/>
        <operator value="notEmpty"/>
      </assert>
    </action>
    <action>
      <assert>
        <resource value="Patient"/>
      </assert>
    </action>
    <action>
      <assert>
        <!--     this operation asserts that the response to the
            read operation contains at a minimumId the resource
            mapped to fixture ID "F1"    -->
        <minimumId value="F1"/>
      </assert>
    </action>
  </test>
  <test id="WRITE01">
    <name value="Write Patient"/>
    <description value="Write the patient read from server 0 to server 1."/>
    <action>
      <operation>
        <!--     this operation creates the fixture "R1" that was read from
            server-0 and creates it on server-1     -->
        <type>
          <code value="create"/>
        </type>
        <destination value="1"/>
        <sourceId value="R1"/>
      </operation>
    </action>
    <action>
      <assert>
        <response value="okay"/>
      </assert>
    </action>
    <action>
      <operation>
        <!--     this operation reads the fixture "R1" from server-1 and
            maps the response to fixture "R2"     -->
        <type>
          <code value="read"/>
        </type>
        <destination value="1"/>
        <responseId value="R2"/>
        <targetId value="R1"/>
      </operation>
    </action>
    <action>
      <assert>
        <response value="okay"/>
      </assert>
    </action>
    <action>
      <assert>
        <headerField value="Last-Modified"/>
        <operator value="notEmpty"/>
      </assert>
    </action>
    <action>
      <assert>
        <resource value="Patient"/>
      </assert>
    </action>
    <action>
      <assert>
        <!--     this operation asserts that the response to the
          read operation contains at a minimumId the resource
          mapped to fixture ID "F1"    -->
        <minimumId value="F1"/>
      </assert>
    </action>
    <action>
      <assert>
        <!--     this [redundant] operation asserts that the response to the
          read operation contains at a minimumId the resource
          mapped to fixture ID "R1"    -->
        <minimumId value="R1"/>
      </assert>
    </action>
  </test>
  <test id="UPDATE01">
    <name value="Update Patient"/>
    <description value="Update the patient on server 0 with the one read from server 1."/>
    <action>
      <operation>
        <!--     this operation updates the fixture "R1" on
          server-0 and with fixture "R2" that was read from server-1     -->
        <type>
          <code value="update"/>
        </type>
        <destination value="0"/>
        <sourceId value="R2"/>
        <targetId value="R1"/>
      </operation>
    </action>
    <action>
      <assert>
        <response value="okay"/>
      </assert>
    </action>
    <action>
      <operation>
        <!--     this operation reads the fixture "R1" from server-0 and
maps the response to fixture "R3"     -->
        <type>
          <code value="read"/>
        </type>
        <destination value="0"/>
        <responseId value="R3"/>
        <targetId value="R1"/>
      </operation>
    </action>
    <action>
      <assert>
        <response value="okay"/>
      </assert>
    </action>
    <action>
      <assert>
        <headerField value="Last-Modified"/>
        <operator value="notEmpty"/>
      </assert>
    </action>
    <action>
      <assert>
        <resource value="Patient"/>
      </assert>
    </action>
    <action>
      <assert>
        <!--     this operation asserts that the response to the
            read operation contains at a minimumId the resource
            mapped to fixture ID "F1"    -->
        <minimumId value="F1"/>
      </assert>
    </action>
    <action>
      <assert>
        <!--     this [redundant] operation asserts that the response to the
            read operation contains at a minimumId the resource
            mapped to fixture ID "R1"    -->
        <minimumId value="R1"/>
      </assert>
    </action>
    <action>
      <assert>
        <!--     this [redundant] operation asserts that the response to the
            read operation contains at a minimumId the resource
            mapped to fixture ID "R1"    -->
        <minimumId value="R2"/>
      </assert>
    </action>
  </test>
  <teardown>
    <!--     delete the patient from server-0     -->
    <action>
      <operation>
        <type>
          <code value="delete"/>
        </type>
        <destination value="0"/>
        <targetId value="F1"/>
      </operation>
    </action>
    <!--     delete the patient from server-1     -->
    <action>
      <operation>
        <type>
          <code value="delete"/>
        </type>
        <destination value="1"/>
        <targetId value="F1"/>
      </operation>
    </action>
  </teardown>
</TestScript>

Usage note: every effort has been made to ensure that the examples are correct and useful, but they are not a normative part of the specification.