<?xml version=“1.0” encoding=“UTF-8”?> <TestScript xmlns=“hl7.org/fhir”>
<id value="connectathon-14-patient-fhirserver-04-history-client-id-xml"/> <url value="http://wildfhir.aegis.net/fhir/TestScript/connectathon-14-patient-fhirserver-04-history-client-id-xml"/> <name value="FHIR Connectathon 14 - Patient - Formal Testing - FHIR Server - History - Client Assigned Resource Id - XML"/> <status value="draft"/> <publisher value="AEGIS.net, Inc."/> <contact> <name value="Touchstone Support"/> <telecom> <system value="email"/> <value value="Touchstone_Support@aegis.net"/> <use value="work"/> </telecom> </contact> <date value="2016-12-30"/> <description value="Patient Track - Formal Testing - test FHIR Server using the XML format to retrieve a Patient resource instance history. The test setup creates and updates a new Patient resource where the client assigns the resource id. The destination server must support conditional create using the update (PUT) operation, read, history-instance and delete to insure the Patient resource does not exist or is removed prior to test execution."/> <copyright value="© AEGIS.net, Inc. 2015+"/> <metadata> <capability> <required value="true"/> <description value="Patient read, update, delete and history-instance operations"/> <link value="http://hl7.org/fhir/2017Jan/http.html#read"/> <link value="http://hl7.org/fhir/2017Jan/http.html#update"/> <link value="http://hl7.org/fhir/2017Jan/http.html#delete"/> <link value="http://hl7.org/fhir/2017Jan/http.html#history"/> <link value="http://hl7.org/fhir/2017Jan/patient.html"/> <capabilities> <reference value="../_reference/capabilities/PatientCapabilityStatement.xml" /> </capabilities> </capability> </metadata> <fixture id="patient-create"> <resource> <reference value="../_reference/resources/patient-create-client-id.xml"/> </resource> </fixture> <fixture id="patient-update"> <resource> <reference value="../_reference/resources/patient-update-client-id.xml"/> </resource> </fixture> <profile id="bundle-profile"> <reference value="http://hl7.org/fhir/StructureDefinition/Bundle"/> </profile> <profile id="patient-profile"> <reference value="http://hl7.org/fhir/StructureDefinition/Patient"/> </profile> <variable> <name value="patientResourceId"/> <path value="Patient/id"/> <sourceId value="patient-create"/> </variable> <variable> <name value="patientVersionIdUpdated"/> <path value="Patient/meta/versionId"/> <sourceId value="patient-update-read-response"/> </variable> <variable> <name value="patientIdentifier"/> <path value="Patient/identifier/value"/> <sourceId value="patient-create"/> </variable> <variable> <name value="patientFamilyName"/> <path value="Patient/name/family"/> <sourceId value="patient-create"/> </variable> <variable> <name value="patientGivenName"/> <path value="Patient/name/given"/> <sourceId value="patient-create"/> </variable> <variable> <name value="patientGender"/> <path value="Patient/gender"/> <sourceId value="patient-create"/> </variable> <variable> <name value="patientBirthDateUpdated"/> <path value="Patient/birthDate"/> <sourceId value="patient-update"/> </variable> <setup> <action> <operation> <type> <system value="http://hl7.org/fhir/testscript-operation-codes"/> <code value="delete"/> </type> <resource value="Patient"/> <description value="System-generated search and delete operations from conditional delete to insure the patient does not exist on the server."/> <accept value="xml"/> <contentType value="xml"/> <params value="?identifier=${patientIdentifier}&given=${patientGivenName}&family=${patientFamilyName}"/> </operation> </action> <action> <operation> <type> <system value="http://hl7.org/fhir/testscript-operation-codes"/> <code value="updateCreate"/> </type> <resource value="Patient"/> <description value="Create patient with client assigned resource id."/> <accept value="xml"/> <contentType value="xml"/> <params value="/${patientResourceId}"/> <sourceId value="patient-create"/> </operation> </action> <action> <assert> <description value="Confirm that the returned HTTP status is 200(OK) or 201(Created)."/> <direction value="response"/> <operator value="in"/> <responseCode value="200,201"/> </assert> </action> <action> <operation> <type> <system value="http://hl7.org/fhir/testscript-operation-codes"/> <code value="update"/> </type> <resource value="Patient"/> <description value="Update patient with client assigned resource id to generate a second version."/> <accept value="xml"/> <contentType value="xml"/> <params value="/${patientResourceId}"/> <sourceId value="patient-update"/> </operation> </action> <action> <assert> <description value="Confirm that the returned HTTP status is 200(Ok)."/> <direction value="response"/> <responseCode value="200"/> </assert> </action> <action> <operation> <type> <system value="http://hl7.org/fhir/testscript-operation-codes"/> <code value="read"/> </type> <resource value="Patient"/> <description value="Read the updated patient by the known patient resource id in order to save the last version id."/> <accept value="xml"/> <contentType value="none"/> <params value="/${patientResourceId}"/> <responseId value="patient-update-read-response" /> </operation> </action> <action> <assert> <description value="Confirm that the returned HTTP status is 200(OK)."/> <direction value="response"/> <response value="okay"/> </assert> </action> <action> <assert> <description value="Confirm that the returned format is the FHIR XML format."/> <direction value="response"/> <contentType value="xml"/> </assert> </action> <action> <assert> <description value="Confirm that the returned resource type is Patient."/> <direction value="response"/> <resource value="Patient"/> </assert> </action> <action> <assert> <description value="Validate that the returned resource conforms to the base FHIR Patient profile."/> <direction value="response"/> <validateProfileId value="patient-profile"/> </assert> </action> <action> <assert> <description value="Confirm that the resource version is present. This is needed for the test step 01-PatientHistory."/> <direction value="response"/> <operator value="notEmpty"/> <path value="Patient/meta/versionId"/> </assert> </action> </setup> <test id="01-PatientHistory"> <name value="PatientHistory"/> <description value="Test the history-instance operation with XML content. The expected response content is a history Bundle resource containing all versions of the Patient resource in XML format."/> <action> <operation> <resource value="Patient"/> <description value="Retrieve the history Bundle for the Patient instance and verify the first entry is the last updated version."/> <accept value="xml"/> <contentType value="none"/> <params value="/${patientResourceId}/_history"/> </operation> </action> <action> <assert> <description value="Confirm that the returned HTTP status is 200(OK)."/> <direction value="response"/> <responseCode value="200"/> </assert> </action> <action> <assert> <description value="Confirm that the returned HTTP Header Content-Type contains the FHIR mime-type 'application/fhir+xml'."/> <direction value="response"/> <contentType value="xml"/> </assert> </action> <action> <assert> <description value="Confirm that the returned resource type is Bundle."/> <direction value="response"/> <resource value="Bundle"/> </assert> </action> <action> <assert> <description value="Confirm that the returned Bundle conforms to the base FHIR specification."/> <direction value="response"/> <validateProfileId value="bundle-profile"/> </assert> </action> <action> <assert> <description value="Confirm that the returned Bundle type is history."/> <direction value="response"/> <operator value="equals"/> <path value="Bundle/type"/> <value value="history"/> </assert> </action> <action> <assert> <description value="Confirm that the returned history Bundle contains at least 2 entries (greater than 1)."/> <direction value="response"/> <operator value="greaterThan"/> <path value="Bundle/total"/> <value value="1"/> </assert> </action> <action> <assert> <description value="Confirm that the Bundle total value matches or is greater than the number of entries in the Bundle. Warning only to provide users with reviewable results."/> <direction value="response"/> <expression value="Bundle.total.toInteger() >= entry.count()"/> <warningOnly value="true"/> </assert> </action> <action> <assert> <description value="Confirm that the returned Bundle resource first entry contains the expected Patient meta versionId element and value. Warning only to provide users with reviewable results."/> <direction value="response"/> <operator value="equals"/> <path value="Bundle/entry[1]/resource/Patient/meta/versionId"/> <value value="${patientVersionIdUpdated}"/> <warningOnly value="true"/> </assert> </action> <action> <assert> <description value="Confirm that the returned Bundle resource first entry contains the expected Patient identifier element and value. Warning only to provide users with reviewable results."/> <direction value="response"/> <operator value="equals"/> <path value="Bundle/entry[1]/resource/Patient/identifier/value"/> <value value="${patientIdentifier}"/> <warningOnly value="true"/> </assert> </action> <action> <assert> <description value="Confirm that the returned Bundle resource first entry contains the expected Patient family name element and value. Warning only to provide users with reviewable results."/> <direction value="response"/> <operator value="equals"/> <path value="Bundle/entry[1]/resource/Patient/name/family"/> <value value="${patientFamilyName}"/> <warningOnly value="true"/> </assert> </action> <action> <assert> <description value="Confirm that the returned Bundle resource first entry contains the expected Patient given name element and value. Warning only to provide users with reviewable results."/> <direction value="response"/> <operator value="equals"/> <path value="Bundle/entry[1]/resource/Patient/name/given"/> <value value="${patientGivenName}"/> <warningOnly value="true"/> </assert> </action> <action> <assert> <description value="Confirm that the returned Bundle resource first entry contains the expected Patient retained gender element and value. Warning only to provide users with reviewable results."/> <direction value="response"/> <operator value="equals"/> <path value="Bundle/entry[1]/resource/Patient/gender"/> <value value="${patientGender}"/> <warningOnly value="true"/> </assert> </action> <action> <assert> <description value="Confirm that the returned Bundle resource first entry contains the expected Patient updated birthDate element and value. Warning only to provide users with reviewable results."/> <direction value="response"/> <operator value="equals"/> <path value="Bundle/entry[1]/resource/Patient/birthDate"/> <value value="${patientBirthDateUpdated}"/> <warningOnly value="true"/> </assert> </action> </test>
</TestScript>