STU 3 Candidate

This page is part of the FHIR Specification (v1.4.0: STU 3 Ballot 3). 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-readtest.xml

Raw XML (canonical form)

Read TestScript Example (id = "ReadTestScript")

<TestScript xmlns="http://hl7.org/fhir">
  <id value="ReadTestScript"/>
  <text><status value="generated"/><div xmlns="http://www.w3.org/1999/xhtml"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: ReadTestScript</p><p><b>name</b>: ReadTestScript</p><p><b>description</b>: TestScript for Sprinkler tests (R001, R002, R003, R004) for testing basic READ requests.</p><h3>Fixtures</h3><table><tr><td>-</td><td><b>Resource</b></td></tr><tr><td>*</td><td><a>Patient resource</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>SourceId</b></td></tr><tr><td>*</td><td>create</td><td>F1</td></tr></table></blockquote></blockquote><blockquote><p><b>test</b></p><p><b>name</b>: Get Test Data Person</p><p><b>description</b>: Result headers on normal read.</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>required</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><blockquote><p><b>test</b></p><p><b>name</b>: Try Read Unknown Resource Type</p><p><b>description</b>: Read unknown resource type</p><blockquote><p><b>metadata</b></p><h3>Operations</h3><table><tr><td>-</td><td><b>Type</b></td><td><b>Resource</b></td><td><b>Description</b></td><td><b>Link</b></td><td><b>Required</b></td><td><b>Validated</b></td></tr><tr><td>*</td><td>read</td><td>Patient</td><td>Patient Read Operation</td><td><a>http://hl7.org/implement/standards/FHIR-Develop/http.html#read</a></td><td>true</td><td>true</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>test</b></p><p><b>name</b>: Try Read Non Existing Resource</p><p><b>description</b>: Read non-existing resource id</p><blockquote><p><b>metadata</b></p><h3>Operations</h3><table><tr><td>-</td><td><b>Type</b></td><td><b>Resource</b></td><td><b>Description</b></td><td><b>Link</b></td><td><b>Required</b></td><td><b>Validated</b></td></tr><tr><td>*</td><td>read</td><td>Patient</td><td>Patient Read Operation</td><td><a>http://hl7.org/implement/standards/FHIR-Develop/http.html#read</a></td><td>true</td><td>true</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>test</b></p><p><b>name</b>: Try Read Bad Formatted Resource Id</p><p><b>description</b>: Read bad formatted resource id</p><blockquote><p><b>metadata</b></p><h3>Operations</h3><table><tr><td>-</td><td><b>Type</b></td><td><b>Resource</b></td><td><b>Description</b></td><td><b>Link</b></td><td><b>Required</b></td><td><b>Validated</b></td></tr><tr><td>*</td><td>read</td><td>Patient</td><td>Patient Read Operation</td><td><a>http://hl7.org/implement/standards/FHIR-Develop/http.html#read</a></td><td>true</td><td>true</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/multiserver"/>
  <name value="ReadTestScript"/>
  <status value="draft"/>
  <description value="TestScript for Sprinkler tests (R001, R002, R003, R004) for testing basic READ requests."/>
  <metadata>
    <capability>
      <required value="true"/>
      <validated value="true"/>
      <description value="Patient Create, Read, Update, 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#update"/>
      <link value="http://hl7.org/implement/standards/FHIR-Develop/http.html#delete"/>
      <conformance>
        <reference value="Conformance/example"/>
      </conformance>
    </capability>
  </metadata>
  <fixture id="F1">
    <resource>
      <reference value="Patient/example"/>
      <display value="Patient resource"/>
    </resource>
  </fixture>
  <setup>
    <action>
      <operation>
        <type>
          <code value="create"/>
        </type>
        <sourceId value="F1"/>
      </operation>
    </action>
  </setup>
  <test id="R001">
    <name value="Get Test Data Person"/>
    <description value="Result headers on normal read."/>
    <action>
      <operation>
        <type>
          <code value="read"/>
        </type>
        <accept value="xml"/>
        <targetId value="F1"/>
      </operation>
    </action>
    <action>
      <assert>
        <response value="okay"/>
      </assert>
    </action>
    <action>
      <assert>
        <contentType value="xml"/>
      </assert>
    </action>
    <action>
      <assert>
        <headerField value="Last-Modified"/>
        <operator value="notEmpty"/>
      </assert>
    </action>
  </test>
  <test id="R002">
    <name value="Try Read Unknown Resource Type"/>
    <description value="Read unknown resource type"/>
    <action>
      <operation>
        <type>
          <code value="read"/>
        </type>
    <!--   What we really want here is an illegal type, but the validation in the build process
         won't that.
      But Parameters is a valid resource which doesn't have an end-point so should fail.
           -->
        <resource value="Parameters"/>
        <params value="/1"/>
      </operation>
    </action>
    <action>
      <assert>
        <response value="notFound"/>
      </assert>
    </action>
  </test>
  <test id="R003">
    <name value="Try Read Non Existing Resource"/>
    <description value="Read non-existing resource id"/>
    <action>
      <operation>
        <type>
          <code value="read"/>
        </type>
        <resource value="Patient"/>
        <params value="/3141592unlikely"/>
      </operation>
    </action>
    <action>
      <assert>
        <response value="notFound"/>
      </assert>
    </action>
  </test>
  <test id="R004">
    <name value="Try Read Bad Formatted Resource Id"/>
    <description value="Read bad formatted resource id"/>
    <action>
      <operation>
        <type>
          <code value="read"/>
        </type>
        <resource value="Patient"/>
        <params value="/ID-may-not-contain-CAPITALS"/>
      </operation>
    </action>
    <action>
      <assert>
        <response value="bad"/>
      </assert>
    </action>
  </test>
  <teardown>
    <action>
      <operation>
        <type>
          <code value="delete"/>
        </type>
        <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.