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 
History TestScript Example
{
"resourceType": "TestScript",
"id": "history",
"text": {
"status": "generated",
"div": "<div><p><b>Generated Narrative with Details</b></p><p><b>id</b>: history</p><p><b>name</b>: History Test Script</p><p><b>description</b>: Test Script for history 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><p><b>action</b></p><h3>Operations</h3><table><tr><td>-</td><td><b>Type</b></td><td><b>SourceId</b></td><td><b>TargetId</b></td></tr><tr><td>*</td><td>update</td><td>example-patient-updated</td><td>example-patient</td></tr></table></blockquote></blockquote><blockquote><p><b>test</b></p><p><b>name</b>: History for specific resource</p><p><b>description</b>: History for specific resource.</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>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>: 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>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/history",
"name": "History Test Script",
"status": "draft",
"description": "Test Script for history of the patient resource",
"metadata": {
"capability": [
{
"required": 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": "example-patient",
"resource": {
"reference": "Patient/example"
}
},
{
"id": "example-patient-updated",
"resource": {
"reference": "Patient/pat1"
}
}
],
"setup": {
"action": [
{
"operation": {
"type": {
"code": "create"
},
"sourceId": "example-patient"
}
},
{
"operation": {
"type": {
"code": "update"
},
"sourceId": "example-patient-updated",
"targetId": "example-patient"
}
}
]
},
"test": [
{
"id": "HISTORY01",
"name": "History for specific resource",
"description": "History for specific resource.",
"metadata": {
"capability": [
{
"required": true,
"description": "Patient History Operation",
"link": [
"http://hl7.org/implement/standards/FHIR-Develop/http.html#history"
],
"conformance": {
"reference": "Conformance/example"
}
}
]
},
"action": [
{
"operation": {
"type": {
"code": "history"
},
"targetId": "example-patient"
}
},
{
"assert": {
"response": "okay"
}
},
{
"assert": {
"resource": "Bundle"
}
},
{
"assert": {
"operator": "equals",
"path": "fhir:Bundle/fhir:total/@value",
"value": "2"
}
}
]
}
],
"teardown": {
"action": [
{
"operation": {
"type": {
"code": "delete"
},
"targetId": "example-patient"
}
}
]
}
}
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.