{
"description": "TestScript example resource with setup to delete if present and create a new instance of a Patient; and single test definition to read the created Patient with various asserts.",
"_filename": "example/TestScript-testscript-example.json",
"package_name": "hl7.fhir.uv.testing",
"date": "2017-01-18",
"variable": [ {
"name": "createResourceId",
"sourceId": "fixture-patient-create",
"expression": {
"language": "application/xml",
"expression": "Patient/id"
}
} ],
"publisher": "HL7 International / FHIR Infrastructure",
"purpose": "Patient Conditional Create (Update), Read and Delete Operations",
"resourceDefinition": "http://hl7.org/fhir/StructureDefinition/TestScript|0.1.0-snapshot1",
"name": "TestScriptExample",
"copyright": "© HL7.org 2011+",
"type": null,
"experimental": "false",
"resourceType": "TestScript",
"title": "TestScript Example",
"_profile": [ {
"id": "patient-profile"
} ],
"setup": {
"action": [ {
"operation": {
"type": {
"code": "delete",
"system": "http://hl7.org/fhir/restful-interaction"
},
"label": "SetupDeletePatient",
"accept": "json",
"params": "/${createResourceId}",
"resource": "Patient",
"description": "Execute a delete operation to insure the patient does not exist on the server.",
"encodeRequestUrl": true
}
}, {
"assert": {
"operator": "in",
"direction": "response",
"description": "Confirm that the returned HTTP status is 200(OK) or 204(No Content).",
"warningOnly": false,
"responseCode": "200,204",
"stopTestOnFail": false
}
}, {
"operation": {
"description": "Create patient resource on test server using the contents of fixture-patient-create",
"params": "/${createResourceId}",
"type": {
"code": "update",
"system": "http://hl7.org/fhir/restful-interaction"
},
"encodeRequestUrl": true,
"label": "SetupCreatePatient",
"resource": "Patient",
"contentType": "json",
"sourceId": "fixture-patient-create",
"accept": "json"
}
}, {
"assert": {
"direction": "response",
"description": "Confirm that the returned HTTP status is 201(Created).",
"warningOnly": false,
"responseCode": "201",
"stopTestOnFail": false
}
}, {
"operation": {
"type": {
"code": "read",
"system": "http://hl7.org/fhir/restful-interaction"
},
"resource": "Patient",
"targetId": "fixture-patient-create",
"description": "Read the created patient resource on the test server using the id from fixture-patient-create. Verify contents.",
"encodeRequestUrl": true
}
}, {
"assert": {
"response": "okay",
"direction": "response",
"description": "Confirm that the returned HTTP status is 200(OK).",
"warningOnly": false,
"stopTestOnFail": false
}
}, {
"assert": {
"operator": "equals",
"description": "Confirm that the returned Patient contains the expected family name 'Chalmers'. Uses explicit compareToSourceId reference to fixture-patient-create used to create the Patient.",
"warningOnly": false,
"stopTestOnFail": false,
"compareToSourceId": "fixture-patient-create",
"compareToSourceExpression": {
"language": "text/fhirpath",
"expression": "Patient.name.first().family"
}
}
} ]
},
"package_version": "0.1.0-snapshot1",
"status": "draft",
"id": "4edc1a30-43c9-4d7e-bac0-4208bd867f1a",
"kind": null,
"url": "http://hl7.org/fhir/TestScript/testscript-example",
"identifier": [ {
"value": "urn:oid:2.16.840.1.113883.4.642.12.4",
"system": "urn:ietf:rfc:3986"
} ],
"fixture": [ {
"id": "fixture-patient-create",
"autocreate": false,
"autodelete": false
}, {
"id": "fixture-patient-minimum",
"autocreate": false,
"autodelete": false
} ],
"version": "1.0",
"teardown": {
"action": [ {
"operation": {
"type": {
"code": "delete",
"system": "http://hl7.org/fhir/restful-interaction"
},
"resource": "Patient",
"targetId": "fixture-patient-create",
"description": "Delete the patient resource on the test server using the id from fixture-patient-create.",
"encodeRequestUrl": true
}
} ]
},
"contact": [ {
"name": "Support",
"telecom": [ {
"use": "work",
"value": "support@HL7.org",
"system": "email"
} ]
} ],
"test": [ {
"id": "01-ReadPatient",
"name": "Read Patient",
"action": [ {
"operation": {
"type": {
"code": "read",
"system": "http://hl7.org/fhir/restful-interaction"
},
"resource": "Patient",
"targetId": "fixture-patient-create",
"responseId": "fixture-patient-read",
"description": "Read the patient resource on the test server using the id from fixture-patient-create. Prevent URL encoding of the request.",
"encodeRequestUrl": false
}
}, {
"assert": {
"label": "01-ReadPatientOK",
"response": "okay",
"direction": "response",
"description": "Confirm that the returned HTTP status is 200(OK).",
"warningOnly": false,
"stopTestOnFail": false
}
}, {
"assert": {
"operator": "notEmpty",
"direction": "response",
"description": "Confirm that the returned HTTP Header Last-Modified is present. Warning only as the server might not support versioning.",
"headerField": "Last-Modified",
"warningOnly": true,
"stopTestOnFail": false
}
}, {
"assert": {
"resource": "Patient",
"description": "Confirm that the returned resource type is Patient.",
"warningOnly": false,
"stopTestOnFail": false
}
}, {
"assert": {
"description": "Confirm that the returned Patient conforms to the base FHIR specification.",
"warningOnly": false,
"stopTestOnFail": false,
"validateProfileId": "patient-profile"
}
}, {
"assert": {
"value": "Chalmers",
"operator": "equals",
"sourceId": "fixture-patient-read",
"expression": {
"language": "application/xml",
"expression": "fhir:Patient/fhir:name/fhir:family/@value"
},
"description": "Confirm that the returned Patient contains the expected family name 'Chalmers'. Uses explicit sourceId reference to read responseId fixture.",
"warningOnly": false,
"stopTestOnFail": false
}
}, {
"assert": {
"value": "Peter",
"operator": "equals",
"sourceId": "fixture-patient-read",
"expression": {
"language": "application/xml",
"expression": "fhir:Patient/fhir:name/fhir:given/@value"
},
"description": "Confirm that the returned Patient contains the expected given name 'Peter'. Uses explicit sourceId reference to read responseId fixture.",
"warningOnly": false,
"stopTestOnFail": false
}
}, {
"assert": {
"operator": "equals",
"expression": {
"language": "application/xml",
"expression": "fhir:Patient/fhir:name/fhir:family/@value"
},
"description": "Confirm that the returned Patient contains the expected family name 'Chalmers'. Uses explicit compareToSourceId reference to fixture-patient-create used to create the Patient and implicit reference to read response payload.",
"warningOnly": false,
"stopTestOnFail": false,
"compareToSourceId": "fixture-patient-create",
"compareToSourceExpression": {
"language": "application/xml",
"expression": "fhir:Patient/fhir:name/fhir:family/@value"
}
}
}, {
"assert": {
"sourceId": "fixture-patient-read",
"expression": {
"language": "application/xml",
"expression": "fhir:Patient/fhir:name/fhir:given/@value"
},
"description": "Confirm that the returned Patient contains the expected family name 'Chalmers'. Uses explicit compareToSourceId reference to fixture-patient-create used to create the Patient and explicit reference to read response payload and default operator of 'equals'.",
"warningOnly": false,
"stopTestOnFail": false,
"compareToSourceId": "fixture-patient-create",
"compareToSourceExpression": {
"language": "application/xml",
"expression": "fhir:Patient/fhir:name/fhir:given/@value"
}
}
}, {
"assert": {
"minimumId": "fixture-patient-minimum",
"description": "Confirm that the returned resource contains the expected retained elements and values. Warning only to provide users with reviewable results.",
"warningOnly": true,
"stopTestOnFail": false
}
} ],
"description": "Read a Patient and validate response."
} ],
"profile": [ "http://hl7.org/fhir/StructureDefinition/Patient" ]
}