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
Search TestScript Example
{ "resourceType": "TestScript", "id": "search", "text": { "status": "generated", "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: search</p><p><b>name</b>: Read, Search and Conditional Create and Delete</p><p><b>description</b>: Test Script for testing search, read, and conditional create and delete</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>variable</b></p><p><b>name</b>: V1</p><p><b>sourceId</b>: R1</p><p><b>headerField</b>: Location</p></blockquote><blockquote><p><b>variable</b></p><p><b>name</b>: V2</p><p><b>sourceId</b>: R3</p><p><b>path</b>: fhir:Patient/fhir:name/fhir:given/@value</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>Resource</b></td><td><b>Params</b></td></tr><tr><td>*</td><td>delete</td><td>Patient</td><td>given=John&family=Doe</td></tr></table></blockquote></blockquote><blockquote><p><b>test</b></p><p><b>name</b>: Create</p><p><b>description</b>: Create, read, search, conditional create, conditional delete.</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>: Conditional Create Operation</p><p><b>link</b>: <a>http://hl7-fhir.github.io/http.html#2.1.0.13.1</a></p><p><b>required</b>: true</p><p><b>validated</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>: Conditional Delete Operation</p><p><b>link</b>: <a>http://hl7-fhir.github.io/http.html#2.1.0.12.1</a></p><p><b>required</b>: true</p><p><b>validated</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><p><b>operation</b></p><p><b>type</b>: search</p><p><b>resource</b>: Patient</p><p><b>description</b>: Patient Search Operation</p><p><b>link</b>: <a>http://hl7-fhir.github.io/http.html#2.1.0.14</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>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><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>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>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></div>" }, "url": "http://hl7.org/fhir/TestScript/search", "name": "Read, Search and Conditional Create and Delete", "status": "draft", "description": "Test Script for testing search, read, and conditional create and delete", "metadata": { "link": [ { "url": "http://hl7.org/implement/standards/FHIR-Develop/patient.html", "description": "FHIR Patient" } ], "capability": [ { "required": true, "description": "Patient Create and Read Operations", "link": [ "http://hl7.org/implement/standards/FHIR-Develop/http.html#create", "http://hl7.org/implement/standards/FHIR-Develop/http.html#read" ], "conformance": { "reference": "Conformance/example" } }, { "required": true, "description": "Patient Conditional Delete Operation", "link": [ "http://hl7-fhir.github.io/http.html#2.1.0.12.1" ], "conformance": { "reference": "Conformance/example" } }, { "required": true, "description": "Patient Conditional Create Operation", "link": [ "http://hl7-fhir.github.io/http.html#2.1.0.13.1" ], "conformance": { "reference": "Conformance/example" } }, { "validated": true, "description": "Patient Search Operation", "link": [ "http://hl7.org/implement/standards/FHIR-Develop/http.html#search" ], "conformance": { "reference": "Conformance/example" } } ] }, "fixture": [ { "id": "example-patient", "resource": { "reference": "Patient/example" } } ], "variable": [ { "name": "V1", "headerField": "Location", "sourceId": "R1" }, { "name": "V2", "path": "fhir:Patient/fhir:name/fhir:given/@value", "sourceId": "R3" }, { "name": "DefaultValue", "defaultValue": "Replace at Runtime" } ], "setup": { "action": [ { "operation": { "type": { "code": "delete" }, "resource": "Patient", "params": "given=John&family=Doe" } } ] }, "test": [ { "id": "Test1", "name": "Create", "description": "Create, read, search, conditional create, conditional delete.", "action": [ { "operation": { "type": { "code": "create" }, "sourceId": "example-patient" } }, { "assert": { "responseCode": "201" } }, { "operation": { "type": { "code": "search" }, "resource": "Patient", "contentType": "json", "params": "?given=John&family=Doe", "responseId": "R1" } }, { "assert": { "headerField": "Location", "operator": "notEmpty", "warningOnly": true } }, { "assert": { "operator": "equals", "path": "fhir:Patient/fhir:birthDate/@value", "sourceId": "R1", "value": "1974-12-31" } }, { "assert": { "navigationLinks": true, "warningOnly": true } }, { "operation": { "type": { "code": "search" }, "accept": "json", "responseId": "R2", "url": "${V1}" } }, { "assert": { "contentType": "json" } }, { "assert": { "response": "okay" } }, { "operation": { "type": { "code": "search" }, "resource": "Patient", "accept": "json", "params": "?given=John&family=Doe&birthdate=1974-12-31", "responseId": "R3" } }, { "assert": { "contentType": "json" } }, { "assert": { "response": "okay" } }, { "assert": { "compareToSourceId": "R2", "compareToSourcePath": "fhir:Patient/fhir:birthDate/@value", "path": "fhir:Patient/fhir:birthDate/@value", "sourceId": "R3" } }, { "assert": { "path": "fhir:Patient/fhir:name/fhir:given/@value", "sourceId": "R3", "value": "John" } }, { "operation": { "type": { "code": "create" }, "requestHeader": [ { "field": "If-None-Exist", "value": "Patient?given=John&Doe&birthdate=1974-12-31" } ], "sourceId": "F1" } }, { "assert": { "responseCode": "200" } }, { "operation": { "type": { "code": "delete" }, "resource": "Patient", "params": "?given=John&family=Doe&birthdate=1974-12-31" } }, { "operation": { "type": { "code": "read" }, "resource": "Patient", "params": "/${V2}" } }, { "assert": { "responseCode": "410" } } ] } ] }
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.