Test Script

Name/FHIR4-0-0-Advanced/Patient/06-patch/JSONPath/fhir-api-r4-patient-patch-01-jsonpatch-add
DescriptionFHIR API R4 (v4.0.0) Advanced Operation Tests - Patient patch test suite against a single server using JSON 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-jsonpatch-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 JSON 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-jsonpatch-add"/>  
    <name value="FHIR API R4 (v4.0.0) - Patient Patch JSON 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 JSON 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-jsonpatch-add-setup.json"/> 
        </resource> 
    </fixture>  
    <fixture id="patient-patch-add-01"> 
        <autocreate value="false"/>  
        <autodelete value="false"/>  
        <resource> 
            <reference value="./_reference/resources/Patient-patch-jsonpatch-add-01-missing-object.json"/> 
        </resource> 
    </fixture>  
    <fixture id="patient-patch-add-02"> 
        <autocreate value="false"/>  
        <autodelete value="false"/>  
        <resource> 
            <reference value="./_reference/resources/Patient-patch-jsonpatch-add-02-object-member.json"/> 
        </resource> 
    </fixture>  
    <fixture id="patient-patch-add-03"> 
        <autocreate value="false"/>  
        <autodelete value="false"/>  
        <resource> 
            <reference value="./_reference/resources/Patient-patch-jsonpatch-add-03-array-element.json"/> 
        </resource> 
    </fixture>  
    <fixture id="patient-patch-add-04"> 
        <autocreate value="false"/>  
        <autodelete value="false"/>  
        <resource> 
            <reference value="./_reference/resources/Patient-patch-jsonpatch-add-04-nested-object-member.json"/> 
        </resource> 
    </fixture>  
    <fixture id="patient-patch-add-05"> 
        <autocreate value="false"/>  
        <autodelete value="false"/>  
        <resource> 
            <reference value="./_reference/resources/Patient-patch-jsonpatch-add-05-ignore-unknown-element.json"/> 
        </resource> 
    </fixture>  
    <fixture id="patient-patch-add-06"> 
        <autocreate value="false"/>  
        <autodelete value="false"/>  
        <resource> 
            <reference value="./_reference/resources/Patient-patch-jsonpatch-add-06-array-value.json"/> 
        </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-jsonpatch-add-setup-id"/>  
        <path value="Patient/id"/>  
        <sourceId value="patch-jsonpatch-add-setup-search-response"/> 
    </variable>  
    <variable> 
        <name value="search-patch-jsonpatch-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="json"/>  
                <encodeRequestUrl value="true"/>  
                <params value="?identifier=${search-patch-jsonpatch-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 JSON Patch on the destination server."/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <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="json"/>  
                <encodeRequestUrl value="true"/>  
                <params value="?identifier=${search-patch-jsonpatch-add-setup-identifier}"/>  
                <responseId value="patch-jsonpatch-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+json'."/>  
                <contentType value="json"/>  
                <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 JSON 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 JSON 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 JSON Patch where the patch path references a missing nested object."/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <encodeRequestUrl value="true"/>  
                <params value="/${patch-jsonpatch-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+json"/> 
                            </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 JSON 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 JSON 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 JSON Patch where the patch creates a new object member Patient.deceasedBoolean=false."/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <encodeRequestUrl value="true"/>  
                <params value="/${patch-jsonpatch-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+json"/> 
                            </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="json"/>  
                <encodeRequestUrl value="true"/>  
                <params value="/${patch-jsonpatch-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+json'."/>  
                <direction value="response"/>  
                <contentType value="json"/>  
                <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 JSON 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 JSON 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 JSON Patch where the patch creates a new array element for Patient.identifier."/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <encodeRequestUrl value="true"/>  
                <params value="/${patch-jsonpatch-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+json"/> 
                            </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="json"/>  
                <encodeRequestUrl value="true"/>  
                <params value="/${patch-jsonpatch-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+json'."/>  
                <direction value="response"/>  
                <contentType value="json"/>  
                <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"/>  
                <operator value="notEmpty"/>  
                <path value=".identifier[1]"/>  
                <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"/>  
                <operator value="equals"/>  
                <path value=".identifier[1].system"/>  
                <value value="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"/>  
                <operator value="equals"/>  
                <path value=".identifier[1].value"/>  
                <value value="jsonpatch2"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action> 
    </test>  
    <test id="Add-04-NestedObjectMember"> 
        <name value="Add-04-NestedObjectMember"/>  
        <description value="Patch the test Patient using JSON Patch where the patch creates a new nested object member for Patient.generalPractitioner. The expected HTTP response is 200 (OK) and optional content of the patched Patient resource in JSON 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 JSON Patch where the patch creates a new nested object member for Patient.generalPractitioner."/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <encodeRequestUrl value="true"/>  
                <params value="/${patch-jsonpatch-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+json"/> 
                            </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="json"/>  
                <encodeRequestUrl value="true"/>  
                <params value="/${patch-jsonpatch-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+json'."/>  
                <direction value="response"/>  
                <contentType value="json"/>  
                <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 generalPractitioner element."/>  
                <direction value="response"/>  
                <operator value="notEmpty"/>  
                <path value=".generalPractitioner"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the test Patient generalPractitioner element contains the expected display value."/>  
                <direction value="response"/>  
                <operator value="equals"/>  
                <path value=".generalPractitioner.display"/>  
                <value value="Dr Jason Patch"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action> 
    </test>  
    <test id="Add-05-IgnoreUnknownElement"> 
        <name value="Add-05-IgnoreUnknownElement"/>  
        <description value="Patch the test Patient using JSON Patch where the patch adds the new element Patient.birthDate and the JSON Patch contains an unknown add operation element. The expected HTTP response is 200 (OK) and optional content of the patched Patient resource in JSON 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 JSON Patch where the patch adds the new element Patient.birthDate and the JSON Patch contains an unknown add operation element."/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <encodeRequestUrl value="true"/>  
                <params value="/${patch-jsonpatch-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+json"/> 
                            </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="json"/>  
                <encodeRequestUrl value="true"/>  
                <params value="/${patch-jsonpatch-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+json'."/>  
                <direction value="response"/>  
                <contentType value="json"/>  
                <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 birthDate element."/>  
                <direction value="response"/>  
                <operator value="notEmpty"/>  
                <path value=".birthDate"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the test Patient birthDate element contains the expected date value."/>  
                <direction value="response"/>  
                <operator value="equals"/>  
                <path value=".birthDate"/>  
                <value value="1983-06-21"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action> 
    </test>  
    <test id="Add-06-ArrayValue"> 
        <name value="Add-06-ArrayValue"/>  
        <description value="Patch the test Patient using JSON Patch where the patch creates a new array value for Patient.name[0].given. The expected HTTP response is 200 (OK) and optional content of the patched Patient resource in JSON 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 JSON Patch where the patch creates a new array value for Patient.name[0].given."/>  
                <accept value="json"/>  
                <contentType value="json"/>  
                <encodeRequestUrl value="true"/>  
                <params value="/${patch-jsonpatch-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+json"/> 
                            </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="json"/>  
                <encodeRequestUrl value="true"/>  
                <params value="/${patch-jsonpatch-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+json'."/>  
                <direction value="response"/>  
                <contentType value="json"/>  
                <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[0].given[1] element."/>  
                <direction value="response"/>  
                <operator value="notEmpty"/>  
                <path value=".name[0].given[1]"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the test Patient birthDate element contains the expected date value."/>  
                <direction value="response"/>  
                <operator value="equals"/>  
                <path value=".name[0].given[1]"/>  
                <value value="Jay"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action> 
    </test> 
</TestScript>