Test Script

Name/FHIRSandbox/DaVinci/FHIR4-0-1-Formulary/Formulary-BulkData/02-Export-All-InsPlans/02a-InsurancePlan-Export/02a-Formulary-BulkData-InsPlan-Export-InsPlan
Description02a-Formulary BulkData InsurancePlan Export. This test ensures the $export operation is defined, the server is responding correctly to the request parameters (including InsurancePlan, Basic, MedicationKnowledge, and Location resources), and that the status of the request can be verified. The test runs from the $export request through the query status but does NOT assume the status of the request is complete. Servers may respond to the request for status with either the 202 Accepted or 200 OK response.
Version1Latest1
Content
<?xml version="1.0" encoding="UTF-8"?>

<TestScript xmlns="http://hl7.org/fhir">  
    <id value="02a-Formulary-BulkData-InsurancePlan-Export-json"/>  
    <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>FormularyBulkDataInsurancePlanExport</p> 
        </div> 
    </text>  
    <url value="http://wildfhir.aegis.net/fhir4-0-1/TestScript/02a-Formulary-BulkData-InsPlan-Export-InsPlan.xml"/>  
    <name value="FormularyBulkDataInsurancePlanExport"/>  
    <title value="FormularyBulkDataInsurancePlanExport"/>  
    <status value="active"/>  
    <date value="2023-01-30"/>  
    <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="02a-Formulary BulkData InsurancePlan Export.  This test ensures the $export operation is defined, the server is responding correctly to the request parameters (including InsurancePlan, Basic, MedicationKnowledge, and Location resources), and that the status of the request can be verified.  The test runs from the $export request through the query status but does NOT assume the status of the request is complete.  Servers may respond to the request for status with either the 202 Accepted or 200 OK response."/>  
    <copyright value="This FHIR Test Script is licensed under Creative Commons (CC0) 'No Rights Reserved'. Learn more at https://creativecommons.org/licenses"/>  
    <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="bulkDataStatusEndpoint"/>  
        <headerField value="Content-Location"/>  
        <sourceId value="searchResponse"/> 
    </variable>  
    <test id="01-InsurancePlan-Export"> 
        <name value="01-InsurancePlan-Export"/>  
        <description value="01: Touchstone will send a request for InsurancePlan $export types.  Bulk Data Server returns a good response '200' or '202' for the InsurancePlan $export operation."/>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://touchstone.aegis.net/touchstone/fhir/testing/CodeSystem/codesystem-testscript-operation-codes"/>  
                    <code value="export"/> 
                </type>  
                <description value="InsurancePlan Resources"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <params value="InsurancePlan/$export"/>  
                <requestHeader> 
                    <field value="Prefer"/>  
                    <value value="respond-async"/> 
                </requestHeader>  
                <requestHeader> 
                    <field value="Accept"/>  
                    <value value="application/fhir+json"/> 
                </requestHeader>  
                <responseId value="searchResponse"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail"> 
                    <valueBoolean value="false"/> 
                </extension>  
                <description value="InsurancePlan-Export request succeeds when supplied correct information"/>  
                <operator value="in"/>  
                <responseCode value="200,202"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that Content-location header was specified."/>  
                <direction value="response"/>  
                <headerField value="Content-Location"/>  
                <operator value="notEmpty"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action> 
    </test>  
    <test id="02-Get-File-Status"> 
        <name value="02-Get-File-Status"/>  
        <description value="02: Check for BulkData file status using the url from the export response in Content-Location"/>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <description value="Get status at 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> 
                <description value="Confirm that the returned HTTP status is 200 or 202."/>  
                <direction value="response"/>  
                <operator value="in"/>  
                <responseCode value="200,202"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action> 
    </test> 
</TestScript>