CareCommunication Test scripts
4.0.0 - release
This page is part of the CareCommunication Testscripts (v4.0.0: Release) based on FHIR (HL7® FHIR® Standard) R4. . For a full list of available versions, see the Directory of published versions
Active as of 2024-07-15 |
<TestScript xmlns="http://hl7.org/fhir">
<id value="carecommunication-send-reply-new"/>
<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 class="res-header-id"><b>Generated Narrative: TestScript carecommunication-send-reply-new</b></p><a name="carecommunication-send-reply-new"> </a><a name="hccarecommunication-send-reply-new"> </a><a name="carecommunication-send-reply-new-en-US"> </a><p><b>url</b>: <a href="TestScript-carecommunication-send-reply-forward.html">TestScript Reply CareCommunication to a CareCommunication that has been forwarded</a></p><p><b>version</b>: 4.0.0</p><p><b>name</b>: CareCommunicationTestScript</p><p><b>title</b>: Reply CareCommunication to a CareCommunication send by the replying system</p><p><b>status</b>: Active</p><p><b>date</b>: 2024-07-15</p><p><b>contact</b>: MedCom: <a href="mailto:mailto:fhir@medcom.dk">mailto:fhir@medcom.dk</a></p><p><b>description</b>: </p><div><p>Reply CareCommunication to a CareCommunication send by the replying system</p>
</div><p><b>copyright</b>: </p><div><p>MedCom 2023</p>
</div><h3>Origins</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Index</b></td><td><b>Profile</b></td></tr><tr><td style="display: none">*</td><td>1</td><td><a href="http://terminology.hl7.org/5.5.0/CodeSystem-testscript-profile-origin-types.html#testscript-profile-origin-types-FHIR-Client">Test script profile origin type</a> FHIR-Client: FHIR Client</td></tr></table><h3>Destinations</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Index</b></td><td><b>Profile</b></td></tr><tr><td style="display: none">*</td><td>1</td><td><a href="http://terminology.hl7.org/5.5.0/CodeSystem-testscript-profile-destination-types.html#testscript-profile-destination-types-FHIR-Server">Test script profile destination type</a> FHIR-Server: FHIR Server</td></tr></table><blockquote><p><b>fixture</b></p><blockquote><p><b>id</b></p>create-new-message-01</blockquote><p><b>autocreate</b>: false</p><p><b>autodelete</b>: false</p><p><b>resource</b>: <a href="/Fixtures/CareCommunication-fixture.xml">/Fixtures/CareCommunication-fixture.xml</a></p></blockquote><blockquote><p><b>fixture</b></p><blockquote><p><b>id</b></p>create-reply-message-02</blockquote><p><b>autocreate</b>: false</p><p><b>autodelete</b>: false</p><p><b>resource</b>: <a href="/Fixtures/CareCommunication-fixture-empty.xml">/Fixtures/CareCommunication-fixture-empty.xml</a></p></blockquote><p><b>profile</b>: <a href="http://medcomfhir.dk/ig/carecommunication/4.0.1/StructureDefinition-medcom-careCommunication-message.html">??</a></p><blockquote><p><b>variable</b></p><p><b>name</b>: messageHeaderid-new-message-01</p><p><b>expression</b>: Bundle.entry[0].resource.id</p><p><b>sourceId</b>: create-message-new-message-01</p></blockquote><blockquote><p><b>variable</b></p><p><b>name</b>: searchParamIdentifier-new-message</p><p><b>expression</b>: Bundle.entry.resource.ofType(MessageHeader).id</p><p><b>sourceId</b>: create-message-new-message</p></blockquote><blockquote><p><b>variable</b></p><p><b>name</b>: messageHeaderid-reply-message-02</p><p><b>expression</b>: Bundle.entry[0].resource.id</p><p><b>sourceId</b>: create-message-reply-message-02</p></blockquote><blockquote><p><b>variable</b></p><p><b>name</b>: identifier-new-message-01</p><p><b>expression</b>: Bundle.entry.resource.ofType(Communication).identifier.value</p><p><b>sourceId</b>: create-message-new-message-01</p></blockquote><blockquote><p><b>variable</b></p><p><b>name</b>: identifier-reply-message-02</p><p><b>expression</b>: Bundle.entry.resource.ofType(Communication).identifier.value</p><p><b>sourceId</b>: create-message-reply-message-02</p></blockquote><blockquote><p><b>test</b></p><blockquote><p><b>id</b></p>carecommunication-create-new-message-01</blockquote><p><b>name</b>: Create a CareCommunication new-message Message 01</p><p><b>description</b>: Post CareCommunication to the server.</p><blockquote><p><b>action</b></p><h3>Operations</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Type</b></td><td><b>Resource</b></td><td><b>Description</b></td><td><b>Destination</b></td><td><b>EncodeRequestUrl</b></td><td><b>Origin</b></td><td><b>RequestId</b></td><td><b>SourceId</b></td></tr><tr><td style="display: none">*</td><td><a href="http://terminology.hl7.org/5.5.0/CodeSystem-testscript-operation-codes.html#testscript-operation-codes-create">Test script operation code</a> create: Create</td><td>Bundle</td><td>Post a carecommunication</td><td>1</td><td>true</td><td>1</td><td>create-message-new-message-01</td><td>create-new-message-01</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>ValidateProfileId</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td>Validates the bundle against http://medcomfhir.dk/ig/carecommunication/ImplementationGuide/dk.fhir.ig.dk-medcom-carecommunication</td><td>request</td><td>carecommunication</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Operator</b></td><td><b>ResponseCode</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td>Confirm that the returned HTTP status is okay or created.</td><td>response</td><td>in</td><td>200,201</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Resource</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td>Confirm that the client request payload contains a Bundle resource type.</td><td>request</td><td>Bundle</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td>Confirm that the request resource contains the expected eventCoding.code.</td><td>request</td><td>Bundle.entry.resource.ofType(MessageHeader).event.as(Coding).select(code = 'care-communication-message').allTrue()</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td>Confirm that the request resource contains the expected activity code.</td><td>request</td><td>Bundle.entry.resource.ofType(Provenance).where(activity.coding.code = 'new-message').exists()</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td>Confirm that the target reference in Provenance equals MessageHeader.id</td><td>request</td><td>Bundle.entry.resource.ofType(Provenance).where(target.reference.contains(%resource.entry[0].resource.id)).exists()</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td>Confirm that the Communication.identifier is a UUID v4.</td><td>request</td><td>Bundle.entry.resource.ofType(Communication).identifier.value.matches('urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}')</td><td>false</td></tr></table></blockquote></blockquote><blockquote><p><b>test</b></p><blockquote><p><b>id</b></p>carecommunication-create-reply-message-02</blockquote><p><b>name</b>: Create a CareCommunication reply-message Message 02</p><p><b>description</b>: Post CareCommunication to the server.</p><blockquote><p><b>action</b></p><h3>Operations</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Type</b></td><td><b>Resource</b></td><td><b>Description</b></td><td><b>Destination</b></td><td><b>EncodeRequestUrl</b></td><td><b>Origin</b></td><td><b>RequestId</b></td><td><b>SourceId</b></td></tr><tr><td style="display: none">*</td><td><a href="http://terminology.hl7.org/5.5.0/CodeSystem-testscript-operation-codes.html#testscript-operation-codes-create">Test script operation code</a> create: Create</td><td>Bundle</td><td>Post a carecommunication</td><td>1</td><td>true</td><td>1</td><td>create-message-reply-message-02</td><td>create-reply-message-02</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>ValidateProfileId</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td>Validates the bundle against http://medcomfhir.dk/ig/carecommunication/ImplementationGuide/dk.fhir.ig.dk-medcom-carecommunication</td><td>request</td><td>carecommunication</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Operator</b></td><td><b>ResponseCode</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td>Confirm that the returned HTTP status is okay or created.</td><td>response</td><td>in</td><td>200,201</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Resource</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td>Confirm that the client request payload contains a Bundle resource type.</td><td>request</td><td>Bundle</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td>Confirm that the previous MessageHeader.id is identical to Provenance.entity.what</td><td>request</td><td>Bundle.entry.resource.ofType(Provenance).where(entity.what.reference.contains('${messageHeaderid-new-message-01}')).exists()</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td>Confirm that the request resource contains the expected eventCoding.code.</td><td>request</td><td>Bundle.entry.resource.ofType(MessageHeader).event.as(Coding).select(code = 'care-communication-message').allTrue()</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td>Confirm that the role is set to revision. Not used when testing the first message in a stream</td><td>request</td><td>Bundle.entry.resource.ofType(Provenance).entity.where(role = 'revision').exists()</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td>Confirm that the target reference in Provenance equals MessageHeader.id</td><td>request</td><td>Bundle.entry.resource.ofType(Provenance).where(target.reference.contains(%resource.entry[0].resource.id)).exists()</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>Operator</b></td><td><b>Value</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td>Confirm that the 2 Provenance instances exists.</td><td>request</td><td>Bundle.entry.resource.ofType(Provenance).count()</td><td>equals</td><td>2</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td>Confirm that number of payloads is '2'</td><td>request</td><td>Bundle.entry.resource.ofType(Communication).payload.count() = '2'</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td>Confirm that the content is the same in the two messages</td><td>request</td><td>'${identifier-new-message-01}' = '${identifier-reply-message-02}'</td><td>false</td></tr></table></blockquote></blockquote></div>
</text>
<url
value="http://medcomfhir.dk/ig/carecommunicationtestscript/carecommunication-send-reply-new"/>
<version value="4.0.0"/>
<name value="CareCommunicationTestScript"/>
<title
value="Reply CareCommunication to a CareCommunication send by the replying system"/>
<status value="active"/>
<date value="2024-07-15"/>
<contact>
<name value="MedCom"/>
<telecom>
<system value="email"/>
<value value="mailto:fhir@medcom.dk"/>
</telecom>
</contact>
<description
value="Reply CareCommunication to a CareCommunication send by the replying system"/>
<copyright value="MedCom 2023"/>
<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>
<fixture id="create-new-message-01">
<autocreate value="false"/>
<autodelete value="false"/>
<resource>
<reference value="/Fixtures/CareCommunication-fixture.xml"/>
</resource>
</fixture>
<fixture id="create-reply-message-02">
<autocreate value="false"/>
<autodelete value="false"/>
<resource>
<reference value="/Fixtures/CareCommunication-fixture-empty.xml"/>
</resource>
</fixture>
<profile id="carecommunication">🔗
<reference
value="http://medcomfhir.dk/ig/carecommunication/StructureDefinition/medcom-careCommunication-message"/>
</profile>
<variable>
<name value="messageHeaderid-new-message-01"/>
<expression value="Bundle.entry[0].resource.id"/>
<sourceId value="create-message-new-message-01"/>
</variable>
<variable>
<name value="searchParamIdentifier-new-message"/>
<expression value="Bundle.entry.resource.ofType(MessageHeader).id"/>
<sourceId value="create-message-new-message"/>
</variable>
<variable>
<name value="messageHeaderid-reply-message-02"/>
<expression value="Bundle.entry[0].resource.id"/>
<sourceId value="create-message-reply-message-02"/>
</variable>
<variable>
<name value="identifier-new-message-01"/>
<expression
value="Bundle.entry.resource.ofType(Communication).identifier.value"/>
<sourceId value="create-message-new-message-01"/>
</variable>
<variable>
<name value="identifier-reply-message-02"/>
<expression
value="Bundle.entry.resource.ofType(Communication).identifier.value"/>
<sourceId value="create-message-reply-message-02"/>
</variable>
<test id="carecommunication-create-new-message-01">
<name value="Create a CareCommunication new-message Message 01"/>
<description value="Post CareCommunication to the server."/>
<action>
<operation>
<type>
<system
value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
<code value="create"/>
</type>
<resource value="Bundle"/>
<description value="Post a carecommunication"/>
<destination value="1"/>
<encodeRequestUrl value="true"/>
<origin value="1"/>
<requestId value="create-message-new-message-01"/>
<sourceId value="create-new-message-01"/>
</operation>
</action>
<action>
<assert>
<description
value="Validates the bundle against http://medcomfhir.dk/ig/carecommunication/ImplementationGuide/dk.fhir.ig.dk-medcom-carecommunication"/>
<direction value="request"/>
<validateProfileId value="carecommunication"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<description
value="Confirm that the returned HTTP status is okay or created."/>
<direction value="response"/>
<operator value="in"/>
<responseCode value="200,201"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<description
value="Confirm that the client request payload contains a Bundle resource type."/>
<direction value="request"/>
<resource value="Bundle"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<description
value="Confirm that the request resource contains the expected eventCoding.code."/>
<direction value="request"/>
<expression
value="Bundle.entry.resource.ofType(MessageHeader).event.as(Coding).select(code = 'care-communication-message').allTrue()"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<description
value="Confirm that the request resource contains the expected activity code."/>
<direction value="request"/>
<expression
value="Bundle.entry.resource.ofType(Provenance).where(activity.coding.code = 'new-message').exists()"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<description
value="Confirm that the target reference in Provenance equals MessageHeader.id"/>
<direction value="request"/>
<expression
value="Bundle.entry.resource.ofType(Provenance).where(target.reference.contains(%resource.entry[0].resource.id)).exists()"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<description
value="Confirm that the Communication.identifier is a UUID v4."/>
<direction value="request"/>
<expression
value="Bundle.entry.resource.ofType(Communication).identifier.value.matches('urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}')"/>
<warningOnly value="false"/>
</assert>
</action>
</test>
<test id="carecommunication-create-reply-message-02">
<name value="Create a CareCommunication reply-message Message 02"/>
<description value="Post CareCommunication to the server."/>
<action>
<operation>
<type>
<system
value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
<code value="create"/>
</type>
<resource value="Bundle"/>
<description value="Post a carecommunication"/>
<destination value="1"/>
<encodeRequestUrl value="true"/>
<origin value="1"/>
<requestId value="create-message-reply-message-02"/>
<sourceId value="create-reply-message-02"/>
</operation>
</action>
<action>
<assert>
<description
value="Validates the bundle against http://medcomfhir.dk/ig/carecommunication/ImplementationGuide/dk.fhir.ig.dk-medcom-carecommunication"/>
<direction value="request"/>
<validateProfileId value="carecommunication"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<description
value="Confirm that the returned HTTP status is okay or created."/>
<direction value="response"/>
<operator value="in"/>
<responseCode value="200,201"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<description
value="Confirm that the client request payload contains a Bundle resource type."/>
<direction value="request"/>
<resource value="Bundle"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<description
value="Confirm that the previous MessageHeader.id is identical to Provenance.entity.what"/>
<direction value="request"/>
<expression
value="Bundle.entry.resource.ofType(Provenance).where(entity.what.reference.contains('${messageHeaderid-new-message-01}')).exists()"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<description
value="Confirm that the request resource contains the expected eventCoding.code."/>
<direction value="request"/>
<expression
value="Bundle.entry.resource.ofType(MessageHeader).event.as(Coding).select(code = 'care-communication-message').allTrue()"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<description
value="Confirm that the role is set to revision. Not used when testing the first message in a stream"/>
<direction value="request"/>
<expression
value="Bundle.entry.resource.ofType(Provenance).entity.where(role = 'revision').exists()"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<description
value="Confirm that the target reference in Provenance equals MessageHeader.id"/>
<direction value="request"/>
<expression
value="Bundle.entry.resource.ofType(Provenance).where(target.reference.contains(%resource.entry[0].resource.id)).exists()"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<description value="Confirm that the 2 Provenance instances exists."/>
<direction value="request"/>
<expression value="Bundle.entry.resource.ofType(Provenance).count()"/>
<operator value="equals"/>
<value value="2"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<description value="Confirm that number of payloads is '2'"/>
<direction value="request"/>
<expression
value="Bundle.entry.resource.ofType(Communication).payload.count() = '2'"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<description
value="Confirm that the content is the same in the two messages"/>
<direction value="request"/>
<expression
value="'${identifier-new-message-01}' = '${identifier-reply-message-02}'"/>
<warningOnly value="false"/>
</assert>
</action>
</test>
</TestScript>