DSTU2

This page is part of the FHIR Specification (v1.0.2: DSTU 2). 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-update.xml

Raw XML (canonical form)

Update TestScript Example (id = "update")

<TestScript xmlns="http://hl7.org/fhir">
  <id value="update"/>
  <text><status value="generated"/><div xmlns="http://www.w3.org/1999/xhtml"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: update</p><p><b>name</b>: Update Test Script</p><p><b>description</b>: Test Script for update of the patient resource</p><blockquote><p><b>fixture</b></p><p><b>resource</b>: <a>Patient/patient-example.xml</a></p></blockquote><blockquote><p><b>fixture</b></p><p><b>resource</b>: <a>Patient/patient-example-updated.xml</a></p></blockquote><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>SourceId</b></td></tr><tr><td>*</td><td>create</td><td>example-patient</td></tr></table></blockquote></blockquote><blockquote><p><b>test</b></p><p><b>name</b>: Update Patient</p><p><b>description</b>: Update a patient and validate response.</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>required</b>: true</p></blockquote><blockquote><p><b>operation</b></p><p><b>type</b>: delete</p><p><b>resource</b>: Patient</p><p><b>description</b>: Patient Delete Operation</p><p><b>link</b>: <a>http://hl7.org/implement/standards/FHIR-Develop/http.html#delete</a></p><p><b>required</b>: true</p></blockquote><blockquote><p><b>operation</b></p><p><b>type</b>: update</p><p><b>resource</b>: Patient</p><p><b>description</b>: Patient Update Operation</p><p><b>link</b>: <a>http://hl7.org/implement/standards/FHIR-Develop/http.html#update</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>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><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></div></text>
  <url value="http://hl7.org/fhir/TestScript/update"/>
  <name value="Update Test Script"/>
  <status value="draft"/>
  <description value="Test Script for update of the patient resource"/>
  <fixture id="example-patient">
    <resource>
      <reference value="Patient/example"/>
    </resource>
  </fixture>
  <fixture id="example-patient-updated">
    <resource>
      <reference value="Patient/pat1"/>
    </resource>
  </fixture>  
  <setup>
    <action>
      <operation>
        <type>
          <code value="create"/>
        </type>
        <sourceId value="example-patient"/>
      </operation>
    </action>
  </setup>
  <test id="UPDATE01">
    <name value="Update Patient"/>
    <description value="Update a patient and validate response."/>
    <metadata>
      <capability>
        <required value="true"/>
        <description value="Patient Create, Read, and Delete Operations"/>
        <link value="http://hl7.org/implement/standards/FHIR-Develop/http.html#create"/>
        <link value="http://hl7.org/implement/standards/FHIR-Develop/http.html#read"/>
        <link value="http://hl7.org/implement/standards/FHIR-Develop/http.html#delete"/>
        <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>      
    <action>
      <operation>
        <type>
          <code value="update"/>
        </type>
        <sourceId value="example-patient-updated"/>
        <targetId value="example-patient"/>
      </operation>
    </action>
    <action>
      <assert>
        <responseCode value="201"/>
      </assert>
    </action>
    <action>
      <assert>
        <headerField value="Last-Modified"/>
        <operator value="notEmpty"/>
      </assert>
    </action>
    <action>
      <operation>
        <type>
          <code value="read"/>
        </type>
        <targetId value="example-patient"/>
      </operation>
    </action>
    <action>
      <assert>
        <response value="okay"/>
      </assert>
    </action>
  </test>
  <teardown>
    <action>
      <operation>
        <type>
          <code value="delete"/>
        </type>
        <targetId value="example-patient"/>
      </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.