Name | /FHIRSandbox/DaVinci/FHIR4-0-1-Formulary/Formulary-STU2/02-Negative-Testing/Formulary-STU2-MedicationKnowledge-Negative-json |
Description | Negative TestScript to verify that the MedicationKnowledge endpoint can return the correct error responses for both Search and Read. |
Version | 1 | Latest | 1 |
<?xml version="1.0" encoding="UTF-8"?>
<TestScript xmlns="http://hl7.org/fhir">
<id value="Formulary-STU2-MedicationKnowledge-Negative-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>Negative TestScript to verify that the MedicationKnowledge endpoint can return the correct error responses for both Search and Read.</p>
</div>
</text>
<url value="http://wildfhir.aegis.net/fhir4-0-1/TestScript/Formulary-STU2-MedicationKnowledge-Negative-json"/>
<name value="DaVinciFormularyR401MedicationKnowledgeJSON"/>
<title value="Da Vinci - Formulary - FHIR R4 - 01 MedicationKnowledge Endpoint - JSON"/>
<status value="active"/>
<date value="2022-12-29"/>
<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="Negative TestScript to verify that the MedicationKnowledge endpoint can return the correct error responses for both Search and Read."/>
<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>
<variable>
<name value="Invalid-Search-id"/>
<defaultValue value="FormularyDrug1"/>
<description value="Enter an invalid _id search value to not find a FormularyDrug resource on the MedicationKnowledge endpoint for Negative testing."/>
</variable>
<test id="01-SearchParameter-id">
<name value="SearchParameter-id"/>
<description value="Negative test the _id Search Parameter on the MedicationKnowledge endpoint."/>
<action>
<operation>
<type>
<system value="http://hl7.org/fhir/testscript-operation-codes"/>
<code value="search"/>
</type>
<resource value="MedicationKnowledge"/>
<description value="Negative test the _id Search Parameter on the MedicationKnowledge endpoint."/>
<accept value="json"/>
<destination value="1"/>
<encodeRequestUrl value="true"/>
<origin value="1"/>
<params value="?_id=${Invalid-Search-id}"/>
<responseId value="SearchIdResponse"/>
</operation>
</action>
<action>
<assert>
<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 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>
<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(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-stopTestOnFail">
<valueBoolean value="false"/>
</extension>
<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"/>
<contentType value="json"/>
<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>
<extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail">
<valueBoolean value="false"/>
</extension>
<description value="Confirm that the Bundle type is 'searchset'."/>
<direction value="response"/>
<operator value="equals"/>
<path value=".type"/>
<value value="searchset"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<description value="Confirm that the searchresponse bundle is empty."/>
<direction value="response"/>
<expression value="Bundle.entry.resource.count()"/>
<operator value="equals"/>
<value value="0"/>
<warningOnly value="false"/>
</assert>
</action>
</test>
<test id="05-read-Endpoint">
<name value="read-Endpoint"/>
<description value="Negative test the read endpoint for the MedicationKnowledge API"/>
<action>
<operation>
<type>
<system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
<code value="read"/>
</type>
<resource value="MedicationKnowledge"/>
<description value="Negative test the failure read endpoint for the MedicationKnowledge API"/>
<accept value="json"/>
<destination value="1"/>
<encodeRequestUrl value="true"/>
<origin value="1"/>
<params value="/${Invalid-Search-id}"/>
<responseId value="read-response"/>
</operation>
</action>
<action>
<assert>
<extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail">
<valueBoolean value="false"/>
</extension>
<description value="Verify an error response is returned"/>
<direction value="response"/>
<operator value="in"/>
<responseCode value="400"/>
<warningOnly value="false"/>
</assert>
</action>
</test>
</TestScript>