Test Script

Name/FHIR4-0-1-Advanced/Capabilities/fhir-api-r4-capabilities-01-metadata
DescriptionFHIR API R4 (v4.0.1) Advanced Operation Tests - Capability Metadata test suite against a single server to verify support for the capabilities interaction 'HTTP GET metadata' and the return of a valid CapabilityStatement resource.
Version6Latest6
Content
<?xml version="1.0" encoding="UTF-8"?>

<TestScript xmlns="http://hl7.org/fhir">  
    <id value="fhir-api-r4-patient-capabilities-01-metadata"/>  
    <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.1) - Capability Metadata Suite</p> 
        </div> 
    </text>  
    <url value="http://wildfhir.aegis.net/fhir4-0-1/TestScript/fhir-api-r4-capabilities-01-metadata"/>  
    <name value="FHIR API R4 (v4.0.1) - Capability Metadata Suite"/>  
    <status value="active"/>  
    <date value="2020-02-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.1) Advanced Operation Tests - Capability Metadata test suite against a single server to verify support for the capabilities interaction 'HTTP GET metadata' and the return of a valid CapabilityStatement resource."/>  
    <copyright value="This FHIR Test Script is licensed under Creative Commons (CC0) 'No Rights Reserved'. Learn more at https://creativecommons.org/licenses"/>  
    <origin> 
        <index value="1"/>  
        <profile> 
            <system value="http://terminology.hl7.org/CodeSystem/testscript-profile-origin-types"/>  
            <code value="FHIR-Client"/> 
        </profile> 
    </origin>  
    <destination> 
        <index value="1"/>  
        <profile> 
            <system value="http://terminology.hl7.org/CodeSystem/testscript-profile-destination-types"/>  
            <code value="FHIR-Server"/> 
        </profile> 
    </destination>  
    <profile id="capabilities-profile"> 
        <reference value="http://hl7.org/fhir/StructureDefinition/CapabilityStatement"/> 
    </profile>  
    <test id="01-CapabilityMetadataJSON"> 
        <name value="CapabilityMetadataJSON"/>  
        <description value="Test the HTTP GET metadata capabilities operation with HTTP Header Accept set to JSON format and no request URL parameters defined. The expected response content is the found CapabilityStatement resource in JSON format."/>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://touchstone.com/fhir/testscript-operation-codes-extended"/>  
                    <code value="metadata"/> 
                </type>  
                <description value="HTTP GET metadata capabilities operation with HTTP Header Accept set to JSON format and no request URL parameters defined. The response asserts for all the optional HTTP Headers will be warning only."/>  
                <accept value="json"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <origin value="1"/>  
                <params value="metadata"/>  
                <requestHeader> 
                    <field value="Authorization"/>  
                    <value value="none"/> 
                </requestHeader> 
            </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 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+json'."/>  
                <direction value="response"/>  
                <headerField value="Content-Type"/>  
                <operator value="contains"/>  
                <value value="application/fhir+json"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned HTTP Header ETag is present. Warning only as FHIR servers SHOULD return this header."/>  
                <direction value="response"/>  
                <headerField value="ETag"/>  
                <operator value="notEmpty"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned resource type is CapabilityStatement."/>  
                <direction value="response"/>  
                <resource value="CapabilityStatement"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned CapabilityStatement conforms to the base FHIR specification."/>  
                <direction value="response"/>  
                <validateProfileId value="capabilities-profile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned CapabilityStatement resource minimally contains the declaration of a RESTful server."/>  
                <direction value="response"/>  
                <expression value="CapabilityStatement.rest.where(mode = 'server').exists()"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action> 
    </test>  
    <test id="02-CapabilityMetadataXML"> 
        <name value="CapabilityMetadataXML"/>  
        <description value="Test the HTTP GET metadata capabilities operation with HTTP Header Accept set to XML format and no request URL parameters defined. The expected response content is the found CapabilityStatement resource in XML format."/>  
        <action> 
            <operation> 
                <type> 
                    <system value="http://touchstone.com/fhir/testscript-operation-codes-extended"/>  
                    <code value="metadata"/> 
                </type>  
                <description value="HTTP GET metadata capabilities operation with HTTP Header Accept set to XML format and no request URL parameters defined. The response asserts for all the optional HTTP Headers will be warning only."/>  
                <accept value="xml"/>  
                <destination value="1"/>  
                <encodeRequestUrl value="true"/>  
                <origin value="1"/>  
                <params value="metadata"/>  
                <requestHeader> 
                    <field value="Authorization"/>  
                    <value value="none"/> 
                </requestHeader> 
            </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 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"/>  
                <headerField value="Content-Type"/>  
                <operator value="contains"/>  
                <value value="application/fhir+xml"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned HTTP Header ETag is present. Warning only as FHIR servers SHOULD return this header."/>  
                <direction value="response"/>  
                <headerField value="ETag"/>  
                <operator value="notEmpty"/>  
                <warningOnly value="true"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned resource type is CapabilityStatement."/>  
                <direction value="response"/>  
                <resource value="CapabilityStatement"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned CapabilityStatement conforms to the base FHIR specification."/>  
                <direction value="response"/>  
                <validateProfileId value="capabilities-profile"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action>  
        <action> 
            <assert> 
                <description value="Confirm that the returned CapabilityStatement resource minimally contains the declaration of a RESTful server."/>  
                <direction value="response"/>  
                <expression value="CapabilityStatement.rest.where(mode = 'server').exists()"/>  
                <warningOnly value="false"/> 
            </assert> 
        </action> 
    </test> 
</TestScript>