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 
Read TestScript Example
@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
# - resource -------------------------------------------------------------------
<http://hl7.org/fhir/TestScript/ReadTestScript> a fhir:TestScript;
fhir:nodeRole fhir:treeRoot;
fhir:Resource.id [ fhir:value "ReadTestScript"];
fhir:DomainResource.text [
fhir:Narrative.status [ fhir:value "generated" ];
fhir:Narrative.div "<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>"
];
fhir:TestScript.url [ fhir:value "http://hl7.org/fhir/TestScript/multiserver"];
fhir:TestScript.name [ fhir:value "ReadTestScript"];
fhir:TestScript.status [ fhir:value "draft"];
fhir:TestScript.description [ fhir:value "TestScript for Sprinkler tests (R001, R002, R003, R004) for testing basic READ requests."];
fhir:TestScript.metadata [
fhir:TestScript.metadata.capability [
fhir:index 0;
fhir:TestScript.metadata.capability.required [ fhir:value "true"^^xsd:boolean ];
fhir:TestScript.metadata.capability.validated [ fhir:value "true"^^xsd:boolean ];
fhir:TestScript.metadata.capability.description [ fhir:value "Patient Create, Read, Update, and Delete Operations" ];
fhir:TestScript.metadata.capability.link [
fhir:value "http://hl7.org/implement/standards/FHIR-Develop/http.html#create";
fhir:index 0
], [
fhir:value "http://hl7.org/implement/standards/FHIR-Develop/http.html#read";
fhir:index 1
], [
fhir:value "http://hl7.org/implement/standards/FHIR-Develop/http.html#update";
fhir:index 2
], [
fhir:value "http://hl7.org/implement/standards/FHIR-Develop/http.html#delete";
fhir:index 3
];
fhir:TestScript.metadata.capability.conformance [
fhir:link <http://hl7.org/fhir/Conformance/example>;
fhir:Reference.reference [ fhir:value "Conformance/example" ]
]
]
];
fhir:TestScript.fixture [
fhir:index 0;
fhir:Element.id [ fhir:value "F1" ];
fhir:TestScript.fixture.resource [
fhir:link <http://hl7.org/fhir/Patient/example>;
fhir:Reference.reference [ fhir:value "Patient/example" ];
fhir:Reference.display [ fhir:value "Patient resource" ]
]
];
fhir:TestScript.setup [
fhir:TestScript.setup.action [
fhir:index 0;
fhir:TestScript.setup.action.operation [
fhir:TestScript.setup.action.operation.type [
fhir:Coding.code [ fhir:value "create" ]
];
fhir:TestScript.setup.action.operation.sourceId [ fhir:value "F1" ]
]
]
];
fhir:TestScript.test [
fhir:index 0;
fhir:Element.id [ fhir:value "R001" ];
fhir:TestScript.test.name [ fhir:value "Get Test Data Person" ];
fhir:TestScript.test.description [ fhir:value "Result headers on normal read." ];
fhir:TestScript.test.action [
fhir:index 0;
fhir:TestScript.test.action.operation [
fhir:TestScript.setup.action.operation.type [
fhir:Coding.code [ fhir:value "read" ]
];
fhir:TestScript.setup.action.operation.accept [ fhir:value "xml" ];
fhir:TestScript.setup.action.operation.targetId [ fhir:value "F1" ]
]
], [
fhir:index 1;
fhir:TestScript.test.action.assert [
fhir:TestScript.setup.action.assert.response [ fhir:value "okay" ]
]
], [
fhir:index 2;
fhir:TestScript.test.action.assert [
fhir:TestScript.setup.action.assert.contentType [ fhir:value "xml" ]
]
], [
fhir:index 3;
fhir:TestScript.test.action.assert [
fhir:TestScript.setup.action.assert.headerField [ fhir:value "Last-Modified" ];
fhir:TestScript.setup.action.assert.operator [ fhir:value "notEmpty" ]
]
]
], [
fhir:index 1;
fhir:Element.id [ fhir:value "R002" ];
fhir:TestScript.test.name [ fhir:value "Try Read Unknown Resource Type" ];
fhir:TestScript.test.description [ fhir:value "Read unknown resource type" ];
fhir:TestScript.test.action [
fhir:index 0;
fhir:TestScript.test.action.operation [
fhir:TestScript.setup.action.operation.type [
fhir:Coding.code [ fhir:value "read" ]
];
fhir:TestScript.setup.action.operation.resource [ fhir:value "Parameters" ];
fhir:TestScript.setup.action.operation.params [ fhir:value "/1" ]
]
], [
fhir:index 1;
fhir:TestScript.test.action.assert [
fhir:TestScript.setup.action.assert.response [ fhir:value "notFound" ]
]
]
], [
fhir:index 2;
fhir:Element.id [ fhir:value "R003" ];
fhir:TestScript.test.name [ fhir:value "Try Read Non Existing Resource" ];
fhir:TestScript.test.description [ fhir:value "Read non-existing resource id" ];
fhir:TestScript.test.action [
fhir:index 0;
fhir:TestScript.test.action.operation [
fhir:TestScript.setup.action.operation.type [
fhir:Coding.code [ fhir:value "read" ]
];
fhir:TestScript.setup.action.operation.resource [ fhir:value "Patient" ];
fhir:TestScript.setup.action.operation.params [ fhir:value "/3141592unlikely" ]
]
], [
fhir:index 1;
fhir:TestScript.test.action.assert [
fhir:TestScript.setup.action.assert.response [ fhir:value "notFound" ]
]
]
], [
fhir:index 3;
fhir:Element.id [ fhir:value "R004" ];
fhir:TestScript.test.name [ fhir:value "Try Read Bad Formatted Resource Id" ];
fhir:TestScript.test.description [ fhir:value "Read bad formatted resource id" ];
fhir:TestScript.test.action [
fhir:index 0;
fhir:TestScript.test.action.operation [
fhir:TestScript.setup.action.operation.type [
fhir:Coding.code [ fhir:value "read" ]
];
fhir:TestScript.setup.action.operation.resource [ fhir:value "Patient" ];
fhir:TestScript.setup.action.operation.params [ fhir:value "/ID-may-not-contain-CAPITALS" ]
]
], [
fhir:index 1;
fhir:TestScript.test.action.assert [
fhir:TestScript.setup.action.assert.response [ fhir:value "bad" ]
]
]
];
fhir:TestScript.teardown [
fhir:TestScript.teardown.action [
fhir:index 0;
fhir:TestScript.teardown.action.operation [
fhir:TestScript.setup.action.operation.type [
fhir:Coding.code [ fhir:value "delete" ]
];
fhir:TestScript.setup.action.operation.targetId [ fhir:value "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.