This page is part of the FHIR Specification (v1.2.0: STU 3 Draft). The current version which supercedes this version is 5.0.0. For a full list of available versions, see the Directory of published versions
Read TestScript Example
{ "resourceType": "TestScript", "id": "ReadTestScript", "text": { "status": "generated", "div": "<div><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>" }, "url": "http://hl7.org/fhir/TestScript/multiserver", "name": "ReadTestScript", "status": "draft", "description": "TestScript for Sprinkler tests (R001, R002, R003, R004) for testing basic READ requests.", "metadata": { "capability": [ { "required": true, "validated": true, "description": "Patient Create, Read, Update, and Delete Operations", "link": [ "http://hl7.org/implement/standards/FHIR-Develop/http.html#create", "http://hl7.org/implement/standards/FHIR-Develop/http.html#read", "http://hl7.org/implement/standards/FHIR-Develop/http.html#update", "http://hl7.org/implement/standards/FHIR-Develop/http.html#delete" ], "conformance": { "reference": "Conformance/example" } } ] }, "fixture": [ { "id": "F1", "resource": { "reference": "Patient/example", "display": "Patient resource" } } ], "setup": { "action": [ { "operation": { "type": { "code": "create" }, "sourceId": "F1" } } ] }, "test": [ { "id": "R001", "name": "Get Test Data Person", "description": "Result headers on normal read.", "action": [ { "operation": { "type": { "code": "read" }, "accept": "xml", "targetId": "F1" } }, { "assert": { "response": "okay" } }, { "assert": { "contentType": "xml" } }, { "assert": { "headerField": "Last-Modified", "operator": "notEmpty" } } ] }, { "id": "R002", "name": "Try Read Unknown Resource Type", "description": "Read unknown resource type", "action": [ { "operation": { "type": { "code": "read" }, "resource": "Parameters", "_resource": { "fhir_comments": [ " What we really want here is an illegal type, but the validation in the build process won't that. \n But Parameters is a valid resource which doesn't have an end-point so should fail. " ] }, "params": "/1" } }, { "assert": { "response": "notFound" } } ] }, { "id": "R003", "name": "Try Read Non Existing Resource", "description": "Read non-existing resource id", "action": [ { "operation": { "type": { "code": "read" }, "resource": "Patient", "params": "/3141592unlikely" } }, { "assert": { "response": "notFound" } } ] }, { "id": "R004", "name": "Try Read Bad Formatted Resource Id", "description": "Read bad formatted resource id", "action": [ { "operation": { "type": { "code": "read" }, "resource": "Patient", "params": "/ID-may-not-contain-CAPITALS" } }, { "assert": { "response": "bad" } } ] } ], "teardown": { "action": [ { "operation": { "type": { "code": "delete" }, "targetId": "F1" } } ] } }
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.