{ "description": "Reply CareCommunication with changed topic", "_filename": "example/TestScript-carecommunication-send-reply-changetopic.json", "package_name": "medcom.fhir.dk.carecommunicationtestscripts", "date": "2024-07-15", "meta": { "profile": [ "http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript" ] }, "variable": [ { "name": "messageHeaderid-new-message-01", "sourceId": "create-message-new-message-01", "expression": "Bundle.entry[0].resource.id" }, { "name": "destinationUri-new-message-01", "sourceId": "create-message-new-message-01", "expression": "Bundle.entry.resource.ofType(MessageHeader).destination.endpoint" }, { "name": "bundleid-new-message-01", "sourceId": "create-message-new-message-01", "expression": "Bundle.id" }, { "name": "messageHeaderid-reply-message-02", "sourceId": "create-message-reply-message-02", "expression": "Bundle.entry[0].resource.id" }, { "name": "topic-new-message-01", "sourceId": "create-message-new-message-01", "expression": "Bundle.entry.resource.ofType(Communication).topic.text" }, { "name": "topic-reply-message-02", "sourceId": "create-message-reply-message-02", "expression": "Bundle.entry.resource.ofType(Communication).topic.text" }, { "name": "identifier-new-message-01", "sourceId": "create-message-new-message-01", "expression": "Bundle.entry.resource.ofType(Communication).identifier.value" }, { "name": "identifier-reply-message-02", "sourceId": "create-message-reply-message-02", "expression": "Bundle.entry.resource.ofType(Communication).identifier.value" } ], "publisher": null, "name": "CareCommunicationTestScript", "copyright": "MedCom 2023", "type": null, "experimental": null, "resourceType": "TestScript", "title": "Reply CareCommunication with changed topic", "setup": { "action": [ { "operation": { "type": { "code": "delete", "system": "http://terminology.hl7.org/CodeSystem/testscript-operation-codes" }, "accept": "xml", "params": "?message.destination-uri=${destinationUri-new-message}", "resource": "Bundle", "description": "System-generated search, delete operations from conditional delete on Bundle MessageHeader.destination.endpoint", "encodeRequestUrl": true } }, { "operation": { "type": { "code": "create", "system": "http://terminology.hl7.org/CodeSystem/testscript-operation-codes" }, "accept": "xml", "resource": "Bundle", "sourceId": "create-new-message-01", "contentType": "xml", "description": "Create the Bundle resource in XML format on the destination server.", "encodeRequestUrl": true } }, { "operation": { "type": { "code": "updateCreate", "system": "http://terminology.hl7.org/CodeSystem/testscript-operation-codes" }, "accept": "xml", "params": "/${bundleid-new-message-01}", "resource": "Bundle", "sourceId": "create-new-message-01", "contentType": "xml", "description": "Update the Bundle.id in XML format on the destination server, so it corresponds to $bundleid-new-message-01.", "encodeRequestUrl": true } }, { "assert": { "operator": "in", "direction": "response", "description": "Confirm that the returned HTTP status is okay or created.", "warningOnly": false, "responseCode": "200,201" } } ] }, "package_version": "4.0.0", "status": "active", "id": "cd4e9ba1-aa93-46b4-a986-a4f19c0df765", "kind": null, "url": "http://medcomfhir.dk/ig/carecommunicationtestscript/carecommunication-send-reply-changetopic", "origin": [ { "index": 1, "profile": { "code": "FHIR-Client", "system": "http://terminology.hl7.org/CodeSystem/testscript-profile-origin-types" } } ], "fixture": [ { "id": "create-new-message-01", "resource": { "reference": "/Fixtures/CareCommunication-fixture.xml" }, "autocreate": false, "autodelete": false }, { "id": "create-reply-message-02", "resource": { "reference": "/Fixtures/CareCommunication-fixture-empty.xml" }, "autocreate": false, "autodelete": false } ], "version": "4.0.0", "contact": [ { "name": "MedCom", "telecom": [ { "value": "mailto:fhir@medcom.dk", "system": "email" } ] } ], "destination": [ { "index": 1, "profile": { "code": "FHIR-Server", "system": "http://terminology.hl7.org/CodeSystem/testscript-profile-destination-types" } } ], "test": [ { "id": "message-read-new-message-01", "name": "Get a new-message message 01", "action": [ { "operation": { "type": { "code": "read", "system": "http://terminology.hl7.org/CodeSystem/testscript-operation-codes" }, "accept": "xml", "origin": 1, "params": "/${bundleid-new-message-01}", "resource": "Bundle", "description": "Receive message", "destination": 1, "encodeRequestUrl": true } }, { "assert": { "operator": "in", "direction": "response", "description": "Confirm that the returned HTTP status is okay or created.", "warningOnly": false, "responseCode": "200,201" } } ], "description": "GET a message. The expected response is a 200(OK) with a payload of the message resource in XML format." }, { "id": "carecommunication-create-reply-message-02", "name": "Create a CareCommunication reply-message Message 02", "action": [ { "operation": { "type": { "code": "create", "system": "http://terminology.hl7.org/CodeSystem/testscript-operation-codes" }, "origin": 1, "resource": "Bundle", "sourceId": "create-reply-message-02", "requestId": "create-message-reply-message-02", "description": "Post a carecommunication", "destination": 1, "encodeRequestUrl": true } }, { "assert": { "direction": "request", "description": "Validates the bundle against http://medcomfhir.dk/ig/carecommunication/ImplementationGuide/dk.fhir.ig.dk-medcom-carecommunication", "warningOnly": false, "validateProfileId": "carecommunication" } }, { "assert": { "operator": "in", "direction": "response", "description": "Confirm that the returned HTTP status is okay or created.", "warningOnly": false, "responseCode": "200,201" } }, { "assert": { "resource": "Bundle", "direction": "request", "description": "Confirm that the client request payload contains a Bundle resource type.", "warningOnly": false } }, { "assert": { "direction": "request", "expression": "Bundle.entry.resource.ofType(Provenance).where(entity.what.reference.contains('${messageHeaderid-new-message-01}')).exists()", "description": "Confirm that the previous MessageHeader.id is identical to Provenance.entity.what", "warningOnly": false } }, { "assert": { "direction": "request", "expression": "Bundle.entry.resource.ofType(MessageHeader).event.as(Coding).select(code = 'care-communication-message').allTrue()", "description": "Confirm that the request resource contains the expected eventCoding.code.", "warningOnly": false } }, { "assert": { "direction": "request", "expression": "Bundle.entry.resource.ofType(Provenance).entity.where(role = 'revision').exists()", "description": "Confirm that the role is set to revision. Not used when testing the first message in a stream", "warningOnly": false } }, { "assert": { "direction": "request", "expression": "Bundle.entry.resource.ofType(Provenance).where(target.reference.contains(%resource.entry[0].resource.id)).exists()", "description": "Confirm that the target reference in Provenance equals MessageHeader.id", "warningOnly": false } }, { "assert": { "value": "2", "operator": "equals", "direction": "request", "expression": "Bundle.entry.resource.ofType(Provenance).count()", "description": "Confirm that the 2 Provenance instances exists.", "warningOnly": false } }, { "assert": { "direction": "request", "expression": "Bundle.entry.resource.ofType(Communication).payload.count() = '2'", "description": "Confirm that number of payloads is '2'", "warningOnly": false } }, { "assert": { "direction": "request", "expression": "'${topic-new-message-01}' != '${topic-reply-message-02}'", "description": "Confirm that the content is different in the two messages", "warningOnly": false } }, { "assert": { "direction": "request", "expression": "'${identifier-new-message-01}' = '${identifier-reply-message-02}'", "description": "Confirm that the content is the same in the two messages", "warningOnly": false } } ], "description": "Post CareCommunication to the server." } ], "profile": [ { "id": "carecommunication", "reference": "http://medcomfhir.dk/ig/carecommunication/StructureDefinition/medcom-careCommunication-message" } ] }