Test Script

Name/FHIR4-0-1-BulkData/02-BulkData-Export/02b-BulkData-Export-StatusComplete
Description02b-BulkData Export Status Complete. This test exercises the BulkData server to ensure that the response for a query to status when the response is 200 OK (complete). The required response elements will be verified and the format of the response verified. The test requires manual entry of a Content-Location URL to allow for testing against systems that cannot complete the $export request immediately, allowing for the time needed for that server to complete the response before the test is attempted. The test may be used for either Group Export or Patient Export.
Version2Latest2
Content
<?xml version="1.0" encoding="UTF-8"?>

<TestScript xmlns="http://hl7.org/fhir">  
    <id value="02b-BulkData-Export-Status-Expected-Complete"/>  
    <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>Bulk Data Export</p> 
        </div> 
    </text>  
    <url value="http://wildfhir.aegis.net/fhir4-0-1/TestScript/bulkdata-group-export-status-complete"/>  
    <name value="BulkDataExportExpectStatusComplete"/>  
    <title value="BulkDataExportExpectStatusComplete"/>  
    <status value="active"/>  
    <date value="2021-01-06"/>  
    <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="02b-BulkData Export Status Complete.  This test exercises the BulkData server to ensure that the response for a query to status when the response is 200 OK (complete).  The required response elements will be verified and the format of the response verified.  The test requires manual entry of a Content-Location URL to allow for testing against systems that cannot complete the $export request immediately, allowing for the time needed for that server to complete the response before the test is attempted.  The test may be used for either Group Export or Patient Export."/>  
    <copyright value="(c) AEGIS.net, Inc. 2021"/>  
    <destination id="Server"> 
        <index value="1"/>  
        <profile> 
            <system value="http://terminology.hl7.org/CodeSystem/testscript-profile-destination-types"/>  
            <code value="FHIR-Server"/> 
        </profile> 
    </destination>  
    <variable> 
        <name value="PatientFileLocation"/>  
        <path value=".output[?(@.type=='Patient')].url"/>  
        <sourceId value="searchResponse"/> 
    </variable>  
    <variable> 
        <name value="BulkDataStatusEndpoint"/>  
        <description value="Content-Location URL"/>  
        <hint value="Content-Location in response from the previous $export operation test"/> 
    </variable>  
    <test id="01-Query-Status-From-Status-Endpoint"> 
        <name value="01-Query-Status-From-Status-Endpoint"/>  
        <description value="01: Query for BulkData file status with expected response '200' and completed file Locations in the response."/>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <description value="Query Content-Location"/>  
                <accept value="json"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <responseId value="searchResponse"/>  
                <url value="${BulkDataStatusEndpoint}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Confirm that the client requested an Accept of the FHIR JSON mime type 'application/fhir+json'."/>  
                <direction value="request"/>  
                <headerField value="Accept"/>  
                <operator value="contains"/>  
                <value value="application/fhir+json"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Confirm that the returned HTTP status is 200.  This test assumes the file build process is complete."/>  
                <direction value="response"/>  
                <operator value="in"/>  
                <responseCode value="200"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Confirm that the returned response contains a value in transactionTime."/>  
                <direction value="response"/>  
                <operator value="notEmpty"/>  
                <path value="$.transactionTime"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Confirm that the returned response contains a value in request."/>  
                <direction value="response"/>  
                <operator value="notEmpty"/>  
                <path value="$.request"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Confirm that the returned response element requiresAccessToken value is 'true'."/>  
                <direction value="response"/>  
                <operator value="equals"/>  
                <path value="$.requiresAccessToken"/>  
                <value value="true"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Confirm that the returned response contains the output element."/>  
                <direction value="response"/>  
                <operator value="notEmpty"/>  
                <path value="$.output"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action> 
    </test>  
    <test id="02-Verify-Output-Patient"> 
        <name value="02-Verify-Output-Patient"/>  
        <description value="02: Inspect the Output array and verify required elements.  This test assumes that at least the Patient resource file is able to be returned.  This test can be used for either a Group Export or a Patient Export, but it will only check for the Patient file in the response."/>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Confirm that a Patient output file count is present.  This is an optional element only."/>  
                <direction value="response"/>  
                <operator value="notEmpty"/>  
                <path value="$.output[?(@.type=='Patient')].count"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="Confirm that a Patient output file url is present."/>  
                <direction value="response"/>  
                <operator value="notEmpty"/>  
                <path value="$.output[?(@.type=='Patient')].url"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action> 
    </test> 
</TestScript>