{ "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. The asserts now include example rule and ruleset definitions to execute.", "_filename": "TestScript-testscript-example-rule.json", "package_name": "hl7.fhir.core", "date": "2017-01-18", "variable": [ { "name": "createResourceId", "path": "Patient/id", "sourceId": "fixture-patient-create" } ], "publisher": "HL7", "jurisdiction": [ { "coding": [ { "code": "US", "system": "urn:iso:std:iso:3166", "display": "United States of America (the)" } ] } ], "purpose": "Patient Conditional Create (Update), Read and Delete Operations", "name": "TestScript Example", "rule": [ { "id": "rule-responseStatusCode", "param": [ { "name": "expectedStatusCode", "value": "200" } ], "resource": { "reference": "TestScript/testscript-example" } } ], "copyright": "© HL7.org 2011+", "type": null, "experimental": "true", "resourceType": "TestScript", "title": null, "setup": { "action": [ { "operation": { "type": { "code": "delete", "system": "http://terminology.hl7.org/CodeSystem/testscript-operation-codes" }, "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" } }, { "operation": { "description": "Create patient resource on test server using the contents of fixture-patient-create", "params": "/${createResourceId}", "type": { "code": "update", "system": "http://terminology.hl7.org/CodeSystem/testscript-operation-codes" }, "encodeRequestUrl": true, "label": "SetupCreatePatient", "resource": "Patient", "contentType": "json", "sourceId": "fixture-patient-create", "accept": "json" } }, { "assert": { "rule": { "param": [ { "name": "expectedStatusCode", "value": "201" } ], "ruleId": "rule-responseStatusCode" }, "label": "Setup-RuleCreateOK", "direction": "response", "description": "Confirm that the returned HTTP status is 201(Created).", "warningOnly": false } } ] }, "package_version": "3.5.0", "status": "draft", "id": "67911aed-a01b-44d1-8243-218a1b80593f", "kind": null, "url": "http://hl7.org/fhir/TestScript/testscript-example-rule", "identifier": { "value": "urn:oid:1.3.6.1.4.1.21367.2005.3.7.9880", "system": "urn:ietf:rfc:3986" }, "fixture": [ { "id": "fixture-patient-create", "resource": { "display": "Peter Chalmers", "reference": "Patient/example" }, "autocreate": false, "autodelete": false }, { "id": "fixture-patient-minimum", "resource": { "display": "Peter Chalmers (minimum)", "reference": "Patient/example" }, "autocreate": false, "autodelete": false } ], "version": "1.0", "ruleset": [ { "id": "ruleset-responseContentTypeStatusCode", "rule": [ { "param": [ { "name": "expectedContentType", "value": "json" } ], "ruleId": "RuleResponseContentType" }, { "param": [ { "name": "expectedStatusCode", "value": "200" } ], "ruleId": "RuleResponseStatusCode" } ], "resource": { "reference": "TestScript/testscript-example" } } ], "contact": [ { "name": "Support", "telecom": [ { "use": "work", "value": "support@HL7.org", "system": "email" } ] } ], "metadata": { "link": [ { "url": "http://hl7.org/fhir/patient.html", "description": "Demographics and other administrative information about an individual or animal receiving care or other health-related services." } ], "capability": [ { "link": [ "http://hl7.org/fhir/http.html#delete", "http://hl7.org/fhir/http.html#read", "http://hl7.org/fhir/http.html#update" ], "required": true, "validated": false, "description": "Patient Update, Read and Delete Operations", "capabilities": "CapabilityStatement/example" } ] }, "test": [ { "id": "01-ReadPatient", "name": "Read Patient", "action": [ { "operation": { "type": { "code": "read", "system": "http://terminology.hl7.org/CodeSystem/testscript-operation-codes" }, "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": { "rule": { "ruleId": "rule-responseStatusCode" }, "label": "01-RuleReadPatientOK", "description": "Confirm that the returned HTTP status is 200(OK).", "warningOnly": false } }, { "assert": { "label": "01-RuleReadPatientContentType", "ruleset": { "rule": [ { "param": [ { "name": "expectedContentType", "value": "XML" } ], "ruleId": "RuleResponseContentType" } ], "rulesetId": "ruleset-responseResourcePatient" }, "warningOnly": 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 } }, { "assert": { "resource": "Patient", "description": "Confirm that the returned resource type is Patient.", "warningOnly": false } }, { "assert": { "description": "Confirm that the returned Patient conforms to the base FHIR specification.", "warningOnly": false, "validateProfileId": "patient-profile" } }, { "assert": { "path": "fhir:Patient/fhir:name/fhir:family/@value", "value": "Chalmers", "operator": "equals", "sourceId": "fixture-patient-read", "description": "Confirm that the returned Patient contains the expected family name 'Chalmers'. Uses explicit sourceId reference to read responseId fixture.", "warningOnly": false } }, { "assert": { "path": "fhir:Patient/fhir:name/fhir:given/@value", "value": "Peter", "operator": "equals", "sourceId": "fixture-patient-read", "description": "Confirm that the returned Patient contains the expected given name 'Peter'. Uses explicit sourceId reference to read responseId fixture.", "warningOnly": false } }, { "assert": { "path": "fhir:Patient/fhir:name/fhir:family/@value", "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 and implicit reference to read response payload.", "warningOnly": false, "compareToSourceId": "fixture-patient-create", "compareToSourcePath": "fhir:Patient/fhir:name/fhir:family/@value" } }, { "assert": { "path": "fhir:Patient/fhir:name/fhir:given/@value", "sourceId": "fixture-patient-read", "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, "compareToSourceId": "fixture-patient-create", "compareToSourcePath": "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 } } ], "description": "Read a patient and validate response." } ], "profile": [ { "id": "patient-profile", "reference": "http://hl7.org/fhir/StructureDefinition/Patient" } ] }