Test Script

Name/FHIR4-0-0-Advanced/Patient/06-patch/XMLPath/fhir-api-r4-patient-patch-01-xmlpatch-add
DescriptionFHIR API R4 (v4.0.0) Advanced Operation Tests - Patient patch test suite against a single server using XML Patch add operation. The destination server must also support the create, delete, read and search operations in order to setup (create) the required resource instances, determine the generated resource id, verify the patched resource instances and clean up the test resources. Assertions test all required and optional response HTTP Headers and validate the returned payload.
Version3Latest3
Content
<?xml version="1.0" encoding="UTF-8"?>

<TestScript xmlns="http://hl7.org/fhir">  
    <id value="fhir-api-r4-patient-patch-01-xmlpatch-add"/>  
    <meta> 
        <profile value="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript"/> 
    </meta>  
    <text> 
        <status value="generated"/>  
        <div xmlns="http://www.w3.org/1999/xhtml">  
            <p>FHIR API R4 (v4.0.0) - Patient Patch XML Patch Add Suite</p> 
        </div> 
    </text>  
    <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-ruleset"> 
        <extension url="rulesetId"> 
            <valueId value="ruleset-versioning-headers"/> 
        </extension>  
        <extension url="path"> 
            <valueString value="/FHIRCommon/_reference/ruleset/RuleSet-VersioningHeaders-Groovy.xml"/> 
        </extension>  
        <extension url="rule"> 
            <extension url="ruleId"> 
                <valueId value="assertETagIfSupported"/> 
            </extension>  
            <extension url="param"> 
                <extension url="name"> 
                    <valueString value="resource"/> 
                </extension>  
                <extension url="value"> 
                    <valueString value="Patient"/> 
                </extension> 
            </extension> 
        </extension>  
        <extension url="rule"> 
            <extension url="ruleId"> 
                <valueId value="assertLastModifiedIfSupported"/> 
            </extension>  
            <extension url="param"> 
                <extension url="name"> 
                    <valueString value="resource"/> 
                </extension>  
                <extension url="value"> 
                    <valueString value="Patient"/> 
                </extension> 
            </extension> 
        </extension> 
    </extension>  
    <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-ruleset"> 
        <extension url="rulesetId"> 
            <valueId value="ruleset-updateok-headers-body"/> 
        </extension>  
        <extension url="path"> 
            <valueString value="/FHIRCommon/_reference/ruleset/RuleSet-UpdateOkHeadersBody-Groovy.xml"/> 
        </extension>  
        <extension url="rule"> 
            <extension url="ruleId"> 
                <valueId value="assertContentTypeIfBody"/> 
            </extension> 
        </extension>  
        <extension url="rule"> 
            <extension url="ruleId"> 
                <valueId value="assertContentTypeCharsetIfBody"/> 
            </extension> 
        </extension>  
        <extension url="rule"> 
            <extension url="ruleId"> 
                <valueId value="assertResourceTypesIfBody"/> 
            </extension>  
            <extension url="param"> 
                <extension url="name"> 
                    <valueString value="resource"/> 
                </extension>  
                <extension url="value"> 
                    <valueString value="Patient,OperationOutcome"/> 
                </extension> 
            </extension> 
        </extension>  
        <extension url="rule"> 
            <extension url="ruleId"> 
                <valueId value="assertProfileIfOperationOutcome"/> 
            </extension>  
            <extension url="param"> 
                <extension url="name"> 
                    <valueString value="validateProfileId"/> 
                </extension>  
                <extension url="value"> 
                    <valueString value="operationoutcome-profile"/> 
                </extension> 
            </extension> 
        </extension>  
        <extension url="rule"> 
            <extension url="ruleId"> 
                <valueId value="assertProfileIfResource"/> 
            </extension>  
            <extension url="param"> 
                <extension url="name"> 
                    <valueString value="resource"/> 
                </extension>  
                <extension url="value"> 
                    <valueString value="Patient"/> 
                </extension> 
            </extension>  
            <extension url="param"> 
                <extension url="name"> 
                    <valueString value="validateProfileId"/> 
                </extension>  
                <extension url="value"> 
                    <valueString value="patient-profile"/> 
                </extension> 
            </extension> 
        </extension>  
        <extension url="rule"> 
            <extension url="ruleId"> 
                <valueId value="assertVersionIdIfResourceAndSupported"/> 
            </extension>  
            <extension url="param"> 
                <extension url="name"> 
                    <valueString value="resource"/> 
                </extension>  
                <extension url="value"> 
                    <valueString value="Patient"/> 
                </extension> 
            </extension>  
            <extension url="param"> 
                <extension url="name"> 
                    <valueString value="resourceOperator"/> 
                </extension>  
                <extension url="value"> 
                    <valueString value="equals"/> 
                </extension> 
            </extension> 
        </extension> 
    </extension>  
    <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-ruleset"> 
        <extension url="rulesetId"> 
            <valueId value="ruleset-updatenotok-headers-body"/> 
        </extension>  
        <extension url="path"> 
            <valueString value="/FHIRCommon/_reference/ruleset/RuleSet-UpdateNotOkHeadersBody-Groovy.xml"/> 
        </extension>  
        <extension url="rule"> 
            <extension url="ruleId"> 
                <valueId value="assertContentTypeIfBody"/> 
            </extension> 
        </extension>  
        <extension url="rule"> 
            <extension url="ruleId"> 
                <valueId value="assertContentTypeCharsetIfBody"/> 
            </extension> 
        </extension>  
        <extension url="rule"> 
            <extension url="ruleId"> 
                <valueId value="assertOperationOutcomeIfError"/> 
            </extension> 
        </extension>  
        <extension url="rule"> 
            <extension url="ruleId"> 
                <valueId value="assertProfileIfOperationOutcome"/> 
            </extension>  
            <extension url="param"> 
                <extension url="name"> 
                    <valueString value="validateProfileId"/> 
                </extension>  
                <extension url="value"> 
                    <valueString value="operationoutcome-profile"/> 
                </extension> 
            </extension> 
        </extension> 
    </extension>  
    <url value="http://wildfhir.aegis.net/fhir4-0-0/TestScript/fhir-api-r4-patient-patch-01-xmlpatch-add"/>  
    <name value="FHIR API R4 (v4.0.0) - Patient Patch XML Patch Add Suite"/>  
    <status value="draft"/>  
    <date value="2019-01-02"/>  
    <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>  
    <description value="FHIR API R4 (v4.0.0) Advanced Operation Tests - Patient patch test suite against a single server using XML Patch add operation. The destination server must also support the create, delete, read and search operations in order to setup (create) the required resource instances, determine the generated resource id, verify the patched resource instances and clean up the test resources. Assertions test all required and optional response HTTP Headers and validate the returned payload."/>  
    <copyright value="(c) AEGIS.net, Inc. 2019"/>  
    <fixture id="patient-patch-setup"> 
        <autocreate value="false"/>  
        <autodelete value="false"/>  
        <resource> 
            <reference value="./_reference/resources/Patient-patch-xmlpatch-add-setup.xml"/> 
        </resource> 
    </fixture>  
    <fixture id="patient-patch-add-01"> 
        <autocreate value="false"/>  
        <autodelete value="false"/>  
        <resource> 
            <reference value="./_reference/resources/Patient-patch-xmlpatch-add-01-missing-object.xml"/> 
        </resource> 
    </fixture>  
    <fixture id="patient-patch-add-02"> 
        <autocreate value="false"/>  
        <autodelete value="false"/>  
        <resource> 
            <reference value="./_reference/resources/Patient-patch-xmlpatch-add-02-object-member.xml"/> 
        </resource> 
    </fixture>  
    <fixture id="patient-patch-add-03"> 
        <autocreate value="false"/>  
        <autodelete value="false"/>  
        <resource> 
            <reference value="./_reference/resources/Patient-patch-xmlpatch-add-03-array-element.xml"/> 
        </resource> 
    </fixture>  
    <fixture id="patient-patch-add-04"> 
        <autocreate value="false"/>  
        <autodelete value="false"/>  
        <resource> 
            <reference value="./_reference/resources/Patient-patch-xmlpatch-add-04-array-element-pos.xml"/> 
        </resource> 
    </fixture>  
    <fixture id="patient-patch-add-05"> 
        <autocreate value="false"/>  
        <autodelete value="false"/>  
        <resource> 
            <reference value="./_reference/resources/Patient-patch-xmlpatch-add-05-multiple.xml"/> 
        </resource> 
    </fixture>  
    <fixture id="patient-patch-add-06"> 
        <autocreate value="false"/>  
        <autodelete value="false"/>  
        <resource> 
            <reference value="./_reference/resources/Patient-patch-xmlpatch-add-06-attribute.xml"/> 
        </resource> 
    </fixture>  
    <fixture id="patient-patch-add-07"> 
        <autocreate value="false"/>  
        <autodelete value="false"/>  
        <resource> 
            <reference value="./_reference/resources/Patient-patch-xmlpatch-add-07-array-members.xml"/> 
        </resource> 
    </fixture>  
    <profile id="patient-profile"> 
        <reference value="http://hl7.org/fhir/StructureDefinition/Patient"/> 
    </profile>  
    <profile id="operationoutcome-profile"> 
        <reference value="http://hl7.org/fhir/StructureDefinition/OperationOutcome"/> 
    </profile>  
    <variable> 
        <name value="patch-xmlpatch-add-setup-id"/>  
        <path value="Patient/id"/>  
        <sourceId value="patch-xmlpatch-add-setup-search-response"/> 
    </variable>  
    <variable> 
        <name value="search-patch-xmlpatch-add-setup-identifier"/>  
        <path value="Patient/identifier/value"/>  
        <sourceId value="patient-patch-setup"/> 
    </variable>  
    <setup> 
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="delete"/> 
                </type>  
                <resource value="Patient"/>  
                <description value="System-generated search and delete operations from conditional delete to insure the test Patient does not exist on the server."/>  
                <accept value="xml"/>  
                <encodeRequestUrl value="true"/>  
                <params value="?identifier=${search-patch-xmlpatch-add-setup-identifier}"/> 
            </operation> 
        </action>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="create"/> 
                </type>  
                <resource value="Patient"/>  
                <description value="Create the test Patient resource for PATCH using XML Patch on the destination server."/>  
                <accept value="xml"/>  
                <contentType value="xml"/>  
                <encodeRequestUrl value="true"/>  
                <sourceId value="patient-patch-setup"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned HTTP status is 201(Created)."/>  
                <direction value="response"/>  
                <responseCode value="201"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <resource value="Patient"/>  
                <description value="Search for the created test Patient by the unique identifier."/>  
                <accept value="xml"/>  
                <encodeRequestUrl value="true"/>  
                <params value="?identifier=${search-patch-xmlpatch-add-setup-identifier}"/>  
                <responseId value="patch-xmlpatch-add-setup-search-response"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned HTTP status is 200(OK)."/>  
                <direction value="response"/>  
                <responseCode value="200"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned HTTP Header Content-Type contains the FHIR mime-type 'application/fhir+xml'."/>  
                <contentType value="xml"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned resource type is Bundle."/>  
                <resource value="Bundle"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that returned bundle first entry contains the created version of the Patient."/>  
                <minimumId value="patient-patch-setup"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action> 
    </setup>  
    <test id="Add-01-MissingObject"> 
        <name value="Add-01-MissingObject"/>  
        <description value="Patch the test Patient using XML Patch where the patch path references a missing nested object. The expected HTTP response is 4xx or 5xx and optional content of an OperationOutcome resource in XML format."/>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://touchstone.aegis.net/fhir/testscript-operation-codes-extended"/>  
                    <code value="patch"/> 
                </type>  
                <resource value="Patient"/>  
                <description value="Patch the test Patient using XML Patch where the patch path references a missing nested object."/>  
                <accept value="xml"/>  
                <contentType value="xml"/>  
                <encodeRequestUrl value="true"/>  
                <params value="/${patch-xmlpatch-add-setup-id}"/>  
                <sourceId value="patient-patch-add-01"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned HTTP status is 4xx or 5xx."/>  
                <direction value="response"/>  
                <operator value="greaterThan"/>  
                <responseCode value="399"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned HTTP Header ETag is not present."/>  
                <direction value="response"/>  
                <headerField value="ETag"/>  
                <operator value="empty"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned HTTP Header Last-Modified is not present."/>  
                <direction value="response"/>  
                <headerField value="Last-Modified"/>  
                <operator value="empty"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned HTTP Header Location is not present."/>  
                <direction value="response"/>  
                <headerField value="Location"/>  
                <operator value="empty"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-ruleset"> 
                    <extension url="rulesetId"> 
                        <valueId value="ruleset-updatenotok-headers-body"/> 
                    </extension>  
                    <extension url="rule"> 
                        <extension url="ruleId"> 
                            <valueId value="assertContentTypeMimeTypeIfBody"/> 
                        </extension>  
                        <extension url="param"> 
                            <extension url="name"> 
                                <valueString value="headerExpectedValue"/> 
                            </extension>  
                            <extension url="value"> 
                                <valueString value="application/fhir+xml"/> 
                            </extension> 
                        </extension> 
                    </extension> 
                </extension>  
                <description value="Complex ruleset assertion to conditionally validate expected patch (update) not ok response HTTP Headers and body."/>  
                <direction value="response"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action> 
    </test>  
    <test id="Add-02-ObjectMember"> 
        <name value="Add-02-ObjectMember"/>  
        <description value="Patch the test Patient using XML Patch where the patch creates a new object member Patient.deceasedBoolean=false. The expected HTTP response is 200 (OK) and optional content of the patched Patient resource in XML format. A Read operation is then used to verify the patched contents were saved."/>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://touchstone.aegis.net/fhir/testscript-operation-codes-extended"/>  
                    <code value="patch"/> 
                </type>  
                <resource value="Patient"/>  
                <description value="Patch the test Patient using XML Patch where the patch creates a new object member Patient.deceasedBoolean=false."/>  
                <accept value="xml"/>  
                <contentType value="xml"/>  
                <encodeRequestUrl value="true"/>  
                <params value="/${patch-xmlpatch-add-setup-id}"/>  
                <sourceId value="patient-patch-add-02"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned HTTP status is 200(OK)."/>  
                <direction value="response"/>  
                <responseCode value="200"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-ruleset"> 
                    <extension url="rulesetId"> 
                        <valueId value="ruleset-versioning-headers"/> 
                    </extension> 
                </extension>  
                <description value="Complex ruleset assertion to conditionally validate expected versioning HTTP Headers."/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-ruleset"> 
                    <extension url="rulesetId"> 
                        <valueId value="ruleset-updateok-headers-body"/> 
                    </extension>  
                    <extension url="rule"> 
                        <extension url="ruleId"> 
                            <valueId value="assertContentTypeMimeTypeIfBody"/> 
                        </extension>  
                        <extension url="param"> 
                            <extension url="name"> 
                                <valueString value="headerExpectedValue"/> 
                            </extension>  
                            <extension url="value"> 
                                <valueString value="application/fhir+xml"/> 
                            </extension> 
                        </extension> 
                    </extension> 
                </extension>  
                <description value="Complex ruleset assertion to conditionally validate expected patch (update) ok response HTTP Headers and body."/>  
                <direction value="response"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="read"/> 
                </type>  
                <resource value="Patient"/>  
                <description value="Read the patched Patient and verify the contents contain the added object."/>  
                <accept value="xml"/>  
                <encodeRequestUrl value="true"/>  
                <params value="/${patch-xmlpatch-add-setup-id}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned HTTP status is 200(OK)."/>  
                <direction value="response"/>  
                <responseCode value="200"/>  
                <warningOnly value="false"/> 
            </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"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned resource type is Patient."/>  
                <direction value="response"/>  
                <resource value="Patient"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned Patient conforms to the base FHIR specification."/>  
                <direction value="response"/>  
                <validateProfileId value="patient-profile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the test Patient contains the added deceasedBoolean object."/>  
                <direction value="response"/>  
                <operator value="notEmpty"/>  
                <path value="/Patient/deceasedBoolean"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the test Patient deceasedBoolean value is equal to false."/>  
                <direction value="response"/>  
                <operator value="equals"/>  
                <path value="/Patient/deceasedBoolean"/>  
                <value value="false"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action> 
    </test>  
    <test id="Add-03-ArrayElement"> 
        <name value="Add-03-ArrayElement"/>  
        <description value="Patch the test Patient using XML Patch where the patch creates a new array element for Patient.identifier. The expected HTTP response is 200 (OK) and optional content of the patched Patient resource in XML format. A Read operation is then used to verify the patched contents were saved."/>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://touchstone.aegis.net/fhir/testscript-operation-codes-extended"/>  
                    <code value="patch"/> 
                </type>  
                <resource value="Patient"/>  
                <description value="Patch the test Patient using XML Patch where the patch creates a new array element for Patient.identifier."/>  
                <accept value="xml"/>  
                <contentType value="xml"/>  
                <encodeRequestUrl value="true"/>  
                <params value="/${patch-xmlpatch-add-setup-id}"/>  
                <sourceId value="patient-patch-add-03"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned HTTP status is 200(OK)."/>  
                <direction value="response"/>  
                <responseCode value="200"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-ruleset"> 
                    <extension url="rulesetId"> 
                        <valueId value="ruleset-versioning-headers"/> 
                    </extension> 
                </extension>  
                <description value="Complex ruleset assertion to conditionally validate expected versioning HTTP Headers."/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-ruleset"> 
                    <extension url="rulesetId"> 
                        <valueId value="ruleset-updateok-headers-body"/> 
                    </extension>  
                    <extension url="rule"> 
                        <extension url="ruleId"> 
                            <valueId value="assertContentTypeMimeTypeIfBody"/> 
                        </extension>  
                        <extension url="param"> 
                            <extension url="name"> 
                                <valueString value="headerExpectedValue"/> 
                            </extension>  
                            <extension url="value"> 
                                <valueString value="application/fhir+xml"/> 
                            </extension> 
                        </extension> 
                    </extension> 
                </extension>  
                <description value="Complex ruleset assertion to conditionally validate expected patch (update) ok response HTTP Headers and body."/>  
                <direction value="response"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="read"/> 
                </type>  
                <resource value="Patient"/>  
                <description value="Read the patched Patient and verify the contents contain the added object."/>  
                <accept value="xml"/>  
                <encodeRequestUrl value="true"/>  
                <params value="/${patch-xmlpatch-add-setup-id}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned HTTP status is 200(OK)."/>  
                <direction value="response"/>  
                <responseCode value="200"/>  
                <warningOnly value="false"/> 
            </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"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned resource type is Patient."/>  
                <direction value="response"/>  
                <resource value="Patient"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned Patient conforms to the base FHIR specification."/>  
                <direction value="response"/>  
                <validateProfileId value="patient-profile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the test Patient contains the added identifier as the second array element."/>  
                <direction value="response"/>  
                <expression value="Patient.identifier.count() = 2"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the test Patient identifier second array element contains the expected system."/>  
                <direction value="response"/>  
                <expression value="Patient.identifier[1].system = 'http://example.org'"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the test Patient identifier second array element contains the expected value."/>  
                <direction value="response"/>  
                <expression value="Patient.identifier[1].value = 'xmlpatch2'"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action> 
    </test>  
    <test id="Add-04-ArrayElementPos"> 
        <name value="Add-04-ArrayElementPos"/>  
        <description value="Patch the test Patient using XML Patch where the patch creates a new array element for Patient.name[0].given before the existing given element. The expected HTTP response is 200 (OK) and optional content of the patched Patient resource in XML format. A Read operation is then used to verify the patched contents were saved."/>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://touchstone.aegis.net/fhir/testscript-operation-codes-extended"/>  
                    <code value="patch"/> 
                </type>  
                <resource value="Patient"/>  
                <description value="Patch the test Patient using XML Patch where the patch creates a new nested object member for Patient.name[0].given before the existing given element."/>  
                <accept value="xml"/>  
                <contentType value="xml"/>  
                <encodeRequestUrl value="true"/>  
                <params value="/${patch-xmlpatch-add-setup-id}"/>  
                <sourceId value="patient-patch-add-04"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned HTTP status is 200(OK)."/>  
                <direction value="response"/>  
                <responseCode value="200"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-ruleset"> 
                    <extension url="rulesetId"> 
                        <valueId value="ruleset-versioning-headers"/> 
                    </extension> 
                </extension>  
                <description value="Complex ruleset assertion to conditionally validate expected versioning HTTP Headers."/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-ruleset"> 
                    <extension url="rulesetId"> 
                        <valueId value="ruleset-updateok-headers-body"/> 
                    </extension>  
                    <extension url="rule"> 
                        <extension url="ruleId"> 
                            <valueId value="assertContentTypeMimeTypeIfBody"/> 
                        </extension>  
                        <extension url="param"> 
                            <extension url="name"> 
                                <valueString value="headerExpectedValue"/> 
                            </extension>  
                            <extension url="value"> 
                                <valueString value="application/fhir+xml"/> 
                            </extension> 
                        </extension> 
                    </extension> 
                </extension>  
                <description value="Complex ruleset assertion to conditionally validate expected patch (update) ok response HTTP Headers and body."/>  
                <direction value="response"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="read"/> 
                </type>  
                <resource value="Patient"/>  
                <description value="Read the patched Patient and verify the contents contain the added object."/>  
                <accept value="xml"/>  
                <encodeRequestUrl value="true"/>  
                <params value="/${patch-xmlpatch-add-setup-id}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned HTTP status is 200(OK)."/>  
                <direction value="response"/>  
                <responseCode value="200"/>  
                <warningOnly value="false"/> 
            </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"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned resource type is Patient."/>  
                <direction value="response"/>  
                <resource value="Patient"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned Patient conforms to the base FHIR specification."/>  
                <direction value="response"/>  
                <validateProfileId value="patient-profile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the test Patient contains the added name.given[1] element."/>  
                <direction value="response"/>  
                <expression value="Patient.name[0].given[0] = 'Xavier'"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action> 
    </test>  
    <test id="Add-05-Multiple"> 
        <name value="Add-05-Multiple"/>  
        <description value="Patch the test Patient using XML Patch where the patch adds multiple new elements for Patient.active and Patient.multipleBirthInteger. The expected HTTP response is 200 (OK) and optional content of the patched Patient resource in XML format. A Read operation is then used to verify the patched contents were saved."/>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://touchstone.aegis.net/fhir/testscript-operation-codes-extended"/>  
                    <code value="patch"/> 
                </type>  
                <resource value="Patient"/>  
                <description value="Patch the test Patient using XML Patch where the patch adds multiple new elements for Patient.active and Patient.multipleBirthInteger."/>  
                <accept value="xml"/>  
                <contentType value="xml"/>  
                <encodeRequestUrl value="true"/>  
                <params value="/${patch-xmlpatch-add-setup-id}"/>  
                <sourceId value="patient-patch-add-05"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned HTTP status is 200(OK)."/>  
                <direction value="response"/>  
                <responseCode value="200"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-ruleset"> 
                    <extension url="rulesetId"> 
                        <valueId value="ruleset-versioning-headers"/> 
                    </extension> 
                </extension>  
                <description value="Complex ruleset assertion to conditionally validate expected versioning HTTP Headers."/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-ruleset"> 
                    <extension url="rulesetId"> 
                        <valueId value="ruleset-updateok-headers-body"/> 
                    </extension>  
                    <extension url="rule"> 
                        <extension url="ruleId"> 
                            <valueId value="assertContentTypeMimeTypeIfBody"/> 
                        </extension>  
                        <extension url="param"> 
                            <extension url="name"> 
                                <valueString value="headerExpectedValue"/> 
                            </extension>  
                            <extension url="value"> 
                                <valueString value="application/fhir+xml"/> 
                            </extension> 
                        </extension> 
                    </extension> 
                </extension>  
                <description value="Complex ruleset assertion to conditionally validate expected patch (update) ok response HTTP Headers and body."/>  
                <direction value="response"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="read"/> 
                </type>  
                <resource value="Patient"/>  
                <description value="Read the patched Patient and verify the contents contain the added objects."/>  
                <accept value="xml"/>  
                <encodeRequestUrl value="true"/>  
                <params value="/${patch-xmlpatch-add-setup-id}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned HTTP status is 200(OK)."/>  
                <direction value="response"/>  
                <responseCode value="200"/>  
                <warningOnly value="false"/> 
            </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"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned resource type is Patient."/>  
                <direction value="response"/>  
                <resource value="Patient"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned Patient conforms to the base FHIR specification."/>  
                <direction value="response"/>  
                <validateProfileId value="patient-profile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the test Patient contains the added active element."/>  
                <direction value="response"/>  
                <operator value="notEmpty"/>  
                <path value="/Patient/active"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the test Patient active element contains the expected boolean value."/>  
                <direction value="response"/>  
                <operator value="equals"/>  
                <path value="/Patient/active"/>  
                <value value="true"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the test Patient contains the added multipleBirthInteger element."/>  
                <direction value="response"/>  
                <operator value="notEmpty"/>  
                <path value="/Patient/multipleBirthInteger"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the test Patient multipleBirthInteger element contains the expected integer value."/>  
                <direction value="response"/>  
                <operator value="equals"/>  
                <path value="/Patient/multipleBirthInteger"/>  
                <value value="1"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action> 
    </test>  
    <test id="Add-06-Attribute"> 
        <name value="Add-06-Attribute"/>  
        <description value="Patch the test Patient using XML Patch where the patch creates a new id attribute for Patient.name[1]. The expected HTTP response is 200 (OK) and optional content of the patched Patient resource in XML format. A Read operation is then used to verify the patched contents were saved."/>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://touchstone.aegis.net/fhir/testscript-operation-codes-extended"/>  
                    <code value="patch"/> 
                </type>  
                <resource value="Patient"/>  
                <description value="Patch the test Patient using XML Patch where the patch creates a new id attribute for Patient.name[1]."/>  
                <accept value="xml"/>  
                <contentType value="xml"/>  
                <encodeRequestUrl value="true"/>  
                <params value="/${patch-xmlpatch-add-setup-id}"/>  
                <sourceId value="patient-patch-add-06"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned HTTP status is 200(OK)."/>  
                <direction value="response"/>  
                <responseCode value="200"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-ruleset"> 
                    <extension url="rulesetId"> 
                        <valueId value="ruleset-versioning-headers"/> 
                    </extension> 
                </extension>  
                <description value="Complex ruleset assertion to conditionally validate expected versioning HTTP Headers."/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-ruleset"> 
                    <extension url="rulesetId"> 
                        <valueId value="ruleset-updateok-headers-body"/> 
                    </extension>  
                    <extension url="rule"> 
                        <extension url="ruleId"> 
                            <valueId value="assertContentTypeMimeTypeIfBody"/> 
                        </extension>  
                        <extension url="param"> 
                            <extension url="name"> 
                                <valueString value="headerExpectedValue"/> 
                            </extension>  
                            <extension url="value"> 
                                <valueString value="application/fhir+xml"/> 
                            </extension> 
                        </extension> 
                    </extension> 
                </extension>  
                <description value="Complex ruleset assertion to conditionally validate expected patch (update) ok response HTTP Headers and body."/>  
                <direction value="response"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="read"/> 
                </type>  
                <resource value="Patient"/>  
                <description value="Read the patched Patient and verify the contents contain the added attribute."/>  
                <accept value="xml"/>  
                <encodeRequestUrl value="true"/>  
                <params value="/${patch-xmlpatch-add-setup-id}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned HTTP status is 200(OK)."/>  
                <direction value="response"/>  
                <responseCode value="200"/>  
                <warningOnly value="false"/> 
            </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"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned resource type is Patient."/>  
                <direction value="response"/>  
                <resource value="Patient"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned Patient conforms to the base FHIR specification."/>  
                <direction value="response"/>  
                <validateProfileId value="patient-profile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the test Patient contains the added name[1] element id attribute."/>  
                <direction value="response"/>  
                <operator value="notEmpty"/>  
                <path value="/Patient/name[1]/@id"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the test Patient name[1] id attribute contains the expected value."/>  
                <direction value="response"/>  
                <operator value="equals"/>  
                <path value="/Patient/name[1]/@id"/>  
                <value value="patchName"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action> 
    </test>  
    <test id="Add-07-ArrayMembers"> 
        <name value="Add-07-ArrayMembers"/>  
        <description value="Patch the test Patient using XML Patch where the patch adds multiple new array elements for Patient.generalPractitioner. The expected HTTP response is 200 (OK) and optional content of the patched Patient resource in XML format. A Read operation is then used to verify the patched contents were saved."/>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://touchstone.aegis.net/fhir/testscript-operation-codes-extended"/>  
                    <code value="patch"/> 
                </type>  
                <resource value="Patient"/>  
                <description value="Patch the test Patient using XML Patch where the patch adds multiple new array elements for Patient.generalPractitioner."/>  
                <accept value="xml"/>  
                <contentType value="xml"/>  
                <encodeRequestUrl value="true"/>  
                <params value="/${patch-xmlpatch-add-setup-id}"/>  
                <sourceId value="patient-patch-add-07"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned HTTP status is 200(OK)."/>  
                <direction value="response"/>  
                <responseCode value="200"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-ruleset"> 
                    <extension url="rulesetId"> 
                        <valueId value="ruleset-versioning-headers"/> 
                    </extension> 
                </extension>  
                <description value="Complex ruleset assertion to conditionally validate expected versioning HTTP Headers."/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-ruleset"> 
                    <extension url="rulesetId"> 
                        <valueId value="ruleset-updateok-headers-body"/> 
                    </extension>  
                    <extension url="rule"> 
                        <extension url="ruleId"> 
                            <valueId value="assertContentTypeMimeTypeIfBody"/> 
                        </extension>  
                        <extension url="param"> 
                            <extension url="name"> 
                                <valueString value="headerExpectedValue"/> 
                            </extension>  
                            <extension url="value"> 
                                <valueString value="application/fhir+xml"/> 
                            </extension> 
                        </extension> 
                    </extension> 
                </extension>  
                <description value="Complex ruleset assertion to conditionally validate expected patch (update) ok response HTTP Headers and body."/>  
                <direction value="response"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="read"/> 
                </type>  
                <resource value="Patient"/>  
                <description value="Read the patched Patient and verify the contents contain the added objects."/>  
                <accept value="xml"/>  
                <encodeRequestUrl value="true"/>  
                <params value="/${patch-xmlpatch-add-setup-id}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned HTTP status is 200(OK)."/>  
                <direction value="response"/>  
                <responseCode value="200"/>  
                <warningOnly value="false"/> 
            </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"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned resource type is Patient."/>  
                <direction value="response"/>  
                <resource value="Patient"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned Patient conforms to the base FHIR specification."/>  
                <direction value="response"/>  
                <validateProfileId value="patient-profile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the test Patient contains the two added generalPractitioner elements."/>  
                <direction value="response"/>  
                <expression value="Patient.generalPractitioner.count() = 2"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the test Patient generalPractitioner[1] element contains the expected display value."/>  
                <direction value="response"/>  
                <expression value="Patient.generalPractitioner[0].display = 'Dr Xavier Patch, MD'"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the test Patient generalPractitioner[2] element contains the expected display value."/>  
                <direction value="response"/>  
                <expression value="Patient.generalPractitioner[1].display = 'Dr Xaviera Patch, OD'"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action> 
    </test> 
</TestScript>