Test Script

Name/FHIRSandbox/DaVinci/FHIR4-0-0-Test/PDex/04-Formulary/01-Query/dv-pdex-r4-04-Formulary-01-Query-01-Rx-Lookup-xml
DescriptionTest the search for Formulary drugs. The expected response content is a MedicationKnowledge resources with one or more matching drugs.
Version3Latest3
Content
<?xml version="1.0" encoding="UTF-8"?>

<TestScript xmlns="http://hl7.org/fhir">  
    <id value="dv-pdex-r4-04-formulary-01-query-rx-lookup-xml"/>  
    <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>Da Vinci - PDex - FHIR R4 - 04 Formulary - 01 Query - Rx Lookup - XML</p>
        </div> 
    </text>  
    <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-rule"> 
        <extension url="ruleId"> 
            <valueId value="rule-validate-PDex-Formulary-Drug"/> 
        </extension>  
        <extension url="path"> 
            <valueString value="/FHIRCommon/_reference/rule/AssertValidateXMLExtractProfileId.groovy"/> 
        </extension>  
        <extension url="param"> 
            <extension url="name"> 
                <valueString value="xPath"/> 
            </extension>  
            <extension url="value"> 
                <valueString value="/Bundle/entry[1]/resource/MedicationKnowledge"/> 
            </extension> 
        </extension>  
        <extension url="param"> 
            <extension url="name"> 
                <valueString value="profileId"/> 
            </extension>  
            <extension url="value"> 
                <valueString value="PDex-Formulary-Drug-profile"/> 
            </extension> 
        </extension> 
    </extension>  
    <url value="http://wildfhir.aegis.net/fhir4-0-0/TestScript/dv-pdex-r4-04-formulary-01-query-rx-lookup-xml"/>  
    <name value="DaVinciPDexR404Formulary01QueryRxLookupXML"/>  
    <title value="Da Vinci - PDex - FHIR R4 - 04 Formulary - 01 Query - Rx Lookup - XML"/>  
    <status value="active"/>  
    <date value="2019-12-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="Test the search for Formulary drugs. The expected response content is a MedicationKnowledge resources with one or more matching drugs."/>  
    <copyright value="(c) AEGIS.net, Inc. 2019"/>  
    <origin> 
        <index value="1"/>  
        <profile> 
            <system value="http://hl7.org/fhir/testscript-profile-origin-types"/>  
            <code value="FHIR-Client"/> 
        </profile> 
    </origin>  
    <destination> 
        <index value="1"/>  
        <profile> 
            <system value="http://hl7.org/fhir/testscript-profile-destination-types"/>  
            <code value="FHIR-Server"/> 
        </profile> 
    </destination>  
    <profile id="bundle-profile"> 
        <reference value="http://hl7.org/fhir/StructureDefinition/Bundle"/> 
    </profile>  
    <profile id="PDex-Formulary-Drug-profile"> 
        <reference value="http://hl7.org/fhir/us/Davinci-drug-formulary/StructureDefinition/usdf-FormularyDrug"/> 
    </profile>  
    <variable> 
        <name value="id"/>  
        <description value="Enter the drug id to look up a medication."/>  
        <hint value="[MedicationKnowledge.id]"/> 
    </variable>  
    <test id="01-Search-LookupFormularyDrugsbyPlanTierNameorRxNorm"> 
        <name value="LookupFormularyDrugs"/>  
        <description value="Look up Formulary Drugs by Plan, Tier, Name and or RxNorm"/>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://hl7.org/fhir/testscript-operation-codes"/>  
                    <code value="search"/> 
                </type>  
                <resource value="MedicationKnowledge"/>  
                <description value="Search for Formulary Drugs conforming to the usdf FormularyDrug profile."/>  
                <accept value="xml"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="false"/>  
                <origin value="1"/>  
                <params value="?_profile=http://hl7.org/fhir/us/Davinci-drug-formulary/StructureDefinition/usdf-FormularyDrug&amp;_id=${id}"/> 
            </operation> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the client requested an Accept of the FHIR XML mime type 'application/fhir+xml'."/>  
                <direction value="request"/>  
                <headerField value="Accept"/>  
                <operator value="contains"/>  
                <value value="application/fhir+xml"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the client did not request a Content-Type. Warning only to allow for systems that automatically send Content-Type."/>  
                <direction value="request"/>  
                <headerField value="Content-Type"/>  
                <operator value="empty"/>  
                <warningOnly value="true"/> 
            </assert> 
        </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 is present."/>  
                <direction value="response"/>  
                <headerField value="Content-Type"/>  
                <operator value="notEmpty"/>  
                <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="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned resource type is Bundle."/>  
                <direction value="response"/>  
                <resource value="Bundle"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned Bundle type is searchset."/>  
                <direction value="response"/>  
                <operator value="equals"/>  
                <path value="Bundle/type"/>  
                <value value="searchset"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned Bundle conforms to the base FHIR specification. Warning only true to allow review of validation results."/>  
                <direction value="response"/>  
                <validateProfileId value="bundle-profile"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned Bundle has more than 0 entries"/>  
                <direction value="response"/>  
                <operator value="greaterThan"/>  
                <path value="Bundle/total"/>  
                <value value="0"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule"> 
                    <extension url="ruleId"> 
                        <valueId value="rule-validate-PDex-Formulary-Drug"/> 
                    </extension> 
                </extension>  
                <description value="(WARNING ONLY) Validate PDex Formulary Drug within the search Bundle. Warning only to allow review of all assert results."/>  
                <direction value="response"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action> 
    </test> 
</TestScript>