Name | /FHIR4-0-1-Basic/P-R/Provenance/Server Assigned Id/Provenance-server-id-json |
Description | FHIR Server Provenance Basic Operation Tests - JSON - Server Assigned Resource Id - Create, Delete, History, Read, Search, Update, Vread. Support for referenced resource type Patient Create, Delete and Search is also required. |
Version | 3 | Latest | 3 |
<?xml version="1.0" encoding="UTF-8"?>
<TestScript xmlns="http://hl7.org/fhir">
<id value="Provenance-server-id-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>FHIR Server Provenance Basic Operation Tests - JSON - Server Assigned Resource Id</p>
</div>
</text>
<extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-ruleset">
<extension url="rulesetId">
<valueId value="ruleset-versioning-headers"/>
</extension>
<extension url="path">
<valueString value="/FHIRCommon/_reference/ruleset/RuleSet-VersioningHeaders-Groovy.xml"/>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertETagIfSupported"/>
</extension>
<extension url="param">
<extension url="name">
<valueString value="resource"/>
</extension>
<extension url="value">
<valueString value="Provenance"/>
</extension>
</extension>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertLastModifiedIfSupported"/>
</extension>
<extension url="param">
<extension url="name">
<valueString value="resource"/>
</extension>
<extension url="value">
<valueString value="Provenance"/>
</extension>
</extension>
</extension>
</extension>
<extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-ruleset">
<extension url="rulesetId">
<valueId value="ruleset-createok-headers-body"/>
</extension>
<extension url="path">
<valueString value="/FHIRCommon/_reference/ruleset/RuleSet-CreateOkHeadersBody-Groovy.xml"/>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertContentTypeIfBody"/>
</extension>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertContentTypeCharsetIfBody"/>
</extension>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertResourceTypesIfBody"/>
</extension>
<extension url="param">
<extension url="name">
<valueString value="resource"/>
</extension>
<extension url="value">
<valueString value="Provenance,OperationOutcome"/>
</extension>
</extension>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertProfileIfOperationOutcome"/>
</extension>
<extension url="param">
<extension url="name">
<valueString value="validateProfileId"/>
</extension>
<extension url="value">
<valueString value="operationoutcome-profile"/>
</extension>
</extension>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertProfileIfResource"/>
</extension>
<extension url="param">
<extension url="name">
<valueString value="resource"/>
</extension>
<extension url="value">
<valueString value="Provenance"/>
</extension>
</extension>
<extension url="param">
<extension url="name">
<valueString value="validateProfileId"/>
</extension>
<extension url="value">
<valueString value="resource-profile"/>
</extension>
</extension>
</extension>
</extension>
<extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-ruleset">
<extension url="rulesetId">
<valueId value="ruleset-updateok-headers-body"/>
</extension>
<extension url="path">
<valueString value="/FHIRCommon/_reference/ruleset/RuleSet-UpdateOkHeadersBody-Groovy.xml"/>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertContentTypeIfBody"/>
</extension>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertContentTypeCharsetIfBody"/>
</extension>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertResourceTypesIfBody"/>
</extension>
<extension url="param">
<extension url="name">
<valueString value="resource"/>
</extension>
<extension url="value">
<valueString value="Provenance,OperationOutcome"/>
</extension>
</extension>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertProfileIfOperationOutcome"/>
</extension>
<extension url="param">
<extension url="name">
<valueString value="validateProfileId"/>
</extension>
<extension url="value">
<valueString value="operationoutcome-profile"/>
</extension>
</extension>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertProfileIfResource"/>
</extension>
<extension url="param">
<extension url="name">
<valueString value="resource"/>
</extension>
<extension url="value">
<valueString value="Provenance"/>
</extension>
</extension>
<extension url="param">
<extension url="name">
<valueString value="validateProfileId"/>
</extension>
<extension url="value">
<valueString value="resource-profile"/>
</extension>
</extension>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertVersionIdIfResourceAndSupported"/>
</extension>
<extension url="param">
<extension url="name">
<valueString value="resource"/>
</extension>
<extension url="value">
<valueString value="Provenance"/>
</extension>
</extension>
<extension url="param">
<extension url="name">
<valueString value="resourceOperator"/>
</extension>
<extension url="value">
<valueString value="equals"/>
</extension>
</extension>
</extension>
</extension>
<extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-ruleset">
<extension url="rulesetId">
<valueId value="ruleset-vreadok-headers-body-if-versioning"/>
</extension>
<extension url="path">
<valueString value="/FHIRCommon/_reference/ruleset/RuleSet-VReadOkHeadersBodyIfVersioning-Groovy.xml"/>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertResponseCodeOkIfVersioning"/>
</extension>
<extension url="param">
<extension url="name">
<valueString value="resource"/>
</extension>
<extension url="value">
<valueString value="Provenance"/>
</extension>
</extension>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertResponseCodeNotFoundIfNotVersioning"/>
</extension>
<extension url="param">
<extension url="name">
<valueString value="resource"/>
</extension>
<extension url="value">
<valueString value="Provenance"/>
</extension>
</extension>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertETagIfSupported"/>
</extension>
<extension url="param">
<extension url="name">
<valueString value="resource"/>
</extension>
<extension url="value">
<valueString value="Provenance"/>
</extension>
</extension>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertLastModifiedIfSupported"/>
</extension>
<extension url="param">
<extension url="name">
<valueString value="resource"/>
</extension>
<extension url="value">
<valueString value="Provenance"/>
</extension>
</extension>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertContentTypeIfBody"/>
</extension>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertContentTypeMimeTypeIfBody"/>
</extension>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertContentTypeCharsetIfBody"/>
</extension>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertResourceTypesIfBody"/>
</extension>
<extension url="param">
<extension url="name">
<valueString value="resource"/>
</extension>
<extension url="value">
<valueString value="Provenance,OperationOutcome"/>
</extension>
</extension>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertProfileIfOperationOutcome"/>
</extension>
<extension url="param">
<extension url="name">
<valueString value="validateProfileId"/>
</extension>
<extension url="value">
<valueString value="operationoutcome-profile"/>
</extension>
</extension>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertProfileIfResource"/>
</extension>
<extension url="param">
<extension url="name">
<valueString value="resource"/>
</extension>
<extension url="value">
<valueString value="Provenance"/>
</extension>
</extension>
<extension url="param">
<extension url="name">
<valueString value="validateProfileId"/>
</extension>
<extension url="value">
<valueString value="resource-profile"/>
</extension>
</extension>
</extension>
</extension>
<extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-ruleset">
<extension url="rulesetId">
<valueId value="ruleset-deletevalid-headers-body"/>
</extension>
<extension url="path">
<valueString value="/FHIRCommon/_reference/ruleset/RuleSet-DeleteValidHeadersBody-NoVersioning-Groovy.xml"/>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertResponseCodeOkIfBody"/>
</extension>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertResponseCodeNoContentIfNoBody"/>
</extension>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertContentTypeIfBody"/>
</extension>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertContentTypeCharsetIfBody"/>
</extension>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertOperationOutcomeIfError"/>
</extension>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertProfileIfOperationOutcome"/>
</extension>
<extension url="param">
<extension url="name">
<valueString value="validateProfileId"/>
</extension>
<extension url="value">
<valueString value="operationoutcome-profile"/>
</extension>
</extension>
</extension>
</extension>
<url value="http://wildfhir.aegis.net/fhir4-0-1/TestScript/Provenance-server-id-json"/>
<name value="Provenance_server_id_json"/>
<title value="FHIR Server Provenance Basic Operation Tests - JSON - Server Assigned Resource Id"/>
<status value="active"/>
<date value="2021-01-26"/>
<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 Server Provenance Basic Operation Tests - JSON - Server Assigned Resource Id - Create, Delete, History, Read, Search, Update, Vread. Support for referenced resource type Patient Create, Delete and Search is also required."/>
<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>
<fixture id="resource-create">
<autocreate value="false"/>
<autodelete value="false"/>
<resource>
<reference value="../_reference/resources/Provenance-create-server-id.json"/>
</resource>
</fixture>
<fixture id="resource-update">
<autocreate value="false"/>
<autodelete value="false"/>
<resource>
<reference value="../_reference/resources/Provenance-update-server-id.json"/>
</resource>
</fixture>
<fixture id="reference-patient-create">
<autocreate value="false"/>
<autodelete value="false"/>
<resource>
<reference value="../_reference/resources/Patient-create-server-id.json"/>
</resource>
</fixture>
<fixture id="reference-practitioner-create">
<autocreate value="false"/>
<autodelete value="false"/>
<resource>
<reference value="../_reference/resources/Practitioner-create-server-id.json"/>
</resource>
</fixture>
<fixture id="reference-consent-create">
<autocreate value="false"/>
<autodelete value="false"/>
<resource>
<reference value="../_reference/resources/Consent-create-server-id.json"/>
</resource>
</fixture>
<fixture id="reference-procedure-create">
<autocreate value="false"/>
<autodelete value="false"/>
<resource>
<reference value="../_reference/resources/Procedure-create-server-id.json"/>
</resource>
</fixture>
<profile id="bundle-profile">
<reference value="http://hl7.org/fhir/StructureDefinition/Bundle"/>
</profile>
<profile id="operationoutcome-profile">
<reference value="http://hl7.org/fhir/StructureDefinition/OperationOutcome"/>
</profile>
<profile id="resource-profile">
<reference value="http://hl7.org/fhir/StructureDefinition/Provenance"/>
</profile>
<variable>
<name value="createResourceId"/>
<path value=".entry[0].resource.id"/>
<sourceId value="create-search-response"/>
</variable>
<variable>
<name value="createVersionId"/>
<path value=".meta.versionId"/>
<sourceId value="create-read-response"/>
</variable>
<variable>
<name value="searchParamIdentifier"/>
<path value=".target[0].reference"/>
<sourceId value="resource-create"/>
</variable>
<variable>
<name value="searchReferencePatientIdentifier"/>
<path value=".identifier[0].value"/>
<sourceId value="reference-patient-create"/>
</variable>
<variable>
<name value="searchReferencePractitionerIdentifier"/>
<path value=".identifier[0].value"/>
<sourceId value="reference-practitioner-create"/>
</variable>
<variable>
<name value="searchReferenceConsentIdentifier"/>
<path value=".identifier[0].value"/>
<sourceId value="reference-consent-create"/>
</variable>
<variable>
<name value="searchReferenceProcedureIdentifier"/>
<path value=".identifier[0].value"/>
<sourceId value="reference-procedure-create"/>
</variable>
<variable>
<name value="referencePatientResourceId"/>
<path value=".entry[0].resource.id"/>
<sourceId value="reference-patient-response"/>
</variable>
<variable>
<name value="referenceProcedureResourceId"/>
<path value=".entry[0].resource.id"/>
<sourceId value="reference-procedure-response"/>
</variable>
<variable>
<name value="referencePractitionerResourceId"/>
<path value=".entry[0].resource.id"/>
<sourceId value="reference-practitioner-response"/>
</variable>
<variable>
<name value="referenceConsentResourceId"/>
<path value=".entry[0].resource.id"/>
<sourceId value="reference-consent-response"/>
</variable>
<setup>
<action>
<operation>
<type>
<system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
<code value="delete"/>
</type>
<resource value="Procedure"/>
<description value="Delete operation to ensure the referenced Procedure does not exist on the server."/>
<accept value="json"/>
<contentType value="none"/>
<encodeRequestUrl value="true"/>
<params value="?identifier=${searchReferenceProcedureIdentifier}"/>
</operation>
</action>
<action>
<assert>
<description value="Confirm that the returned HTTP status is either 200(OK), 204(No Content) or 404(Not Found)."/>
<operator value="in"/>
<responseCode value="200,204,404"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<operation>
<type>
<system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
<code value="delete"/>
</type>
<resource value="Patient"/>
<description value="Delete operation to ensure the referenced Patient does not exist on the server."/>
<accept value="json"/>
<encodeRequestUrl value="true"/>
<params value="?identifier=${searchReferencePatientIdentifier}"/>
</operation>
</action>
<action>
<assert>
<description value="Confirm that the returned HTTP status is either 200(OK), 204(No Content) or 404(Not Found)."/>
<operator value="in"/>
<responseCode value="200,204,404"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<operation>
<type>
<system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
<code value="delete"/>
</type>
<resource value="Practitioner"/>
<description value="Delete operation to ensure the referenced Practitioner does not exist on the server."/>
<accept value="json"/>
<contentType value="none"/>
<encodeRequestUrl value="true"/>
<params value="?identifier=${searchReferencePractitionerIdentifier}"/>
</operation>
</action>
<action>
<assert>
<description value="Confirm that the returned HTTP status is either 200(OK), 204(No Content) or 404(Not Found)."/>
<operator value="in"/>
<responseCode value="200,204,404"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<operation>
<type>
<system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
<code value="delete"/>
</type>
<resource value="Consent"/>
<description value="Delete operation to ensure the referenced Consent does not exist on the server."/>
<accept value="json"/>
<contentType value="none"/>
<encodeRequestUrl value="true"/>
<params value="?identifier=${searchReferenceConsentIdentifier}"/>
</operation>
</action>
<action>
<assert>
<description value="Confirm that the returned HTTP status is either 200(OK), 204(No Content) or 404(Not Found)."/>
<operator value="in"/>
<responseCode value="200,204,404"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<operation>
<type>
<system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
<code value="create"/>
</type>
<resource value="Patient"/>
<description value="Create Patient to be used as a referenced resource"/>
<accept value="json"/>
<contentType value="json"/>
<destination value="1"/>
<encodeRequestUrl value="true"/>
<origin value="1"/>
<sourceId value="reference-patient-create"/>
</operation>
</action>
<action>
<assert>
<description value="Confirm that the returned HTTP status is 201(Created)."/>
<direction value="response"/>
<response value="created"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<operation>
<type>
<system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
<code value="search"/>
</type>
<resource value="Patient"/>
<description value="Search for the created Patient by the unique identifier."/>
<accept value="json"/>
<contentType value="none"/>
<encodeRequestUrl value="true"/>
<params value="?identifier=${searchReferencePatientIdentifier}"/>
<responseId value="reference-patient-response"/>
</operation>
</action>
<action>
<assert>
<description value="Confirm that the returned HTTP status is 200(OK)."/>
<response value="okay"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<operation>
<type>
<system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
<code value="create"/>
</type>
<resource value="Practitioner"/>
<description value="Create Practitioner to be used as a referenced resource"/>
<accept value="json"/>
<contentType value="json"/>
<destination value="1"/>
<encodeRequestUrl value="true"/>
<origin value="1"/>
<sourceId value="reference-practitioner-create"/>
</operation>
</action>
<action>
<assert>
<description value="Confirm that the returned HTTP status is 201(Created)."/>
<direction value="response"/>
<response value="created"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<operation>
<type>
<system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
<code value="search"/>
</type>
<resource value="Practitioner"/>
<description value="Search for the created Practitioner by the unique identifier."/>
<accept value="json"/>
<contentType value="none"/>
<encodeRequestUrl value="true"/>
<params value="?identifier=${searchReferencePractitionerIdentifier}"/>
<responseId value="reference-practitioner-response"/>
</operation>
</action>
<action>
<assert>
<description value="Confirm that the returned HTTP status is 200(OK)."/>
<response value="okay"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<operation>
<type>
<system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
<code value="create"/>
</type>
<resource value="Consent"/>
<description value="Create Consent to be used as a referenced resource"/>
<accept value="json"/>
<contentType value="json"/>
<destination value="1"/>
<encodeRequestUrl value="true"/>
<origin value="1"/>
<sourceId value="reference-consent-create"/>
</operation>
</action>
<action>
<assert>
<description value="Confirm that the returned HTTP status is 201(Created)."/>
<direction value="response"/>
<response value="created"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<operation>
<type>
<system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
<code value="search"/>
</type>
<resource value="Consent"/>
<description value="Search for the created Consent by the unique identifier."/>
<accept value="json"/>
<contentType value="none"/>
<encodeRequestUrl value="true"/>
<params value="?identifier=${searchReferenceConsentIdentifier}"/>
<responseId value="reference-consent-response"/>
</operation>
</action>
<action>
<assert>
<description value="Confirm that the returned HTTP status is 200(OK)."/>
<response value="okay"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<operation>
<type>
<system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
<code value="create"/>
</type>
<resource value="Procedure"/>
<description value="Create Procedure to be used as a referenced resource"/>
<accept value="json"/>
<contentType value="json"/>
<destination value="1"/>
<encodeRequestUrl value="true"/>
<origin value="1"/>
<sourceId value="reference-procedure-create"/>
</operation>
</action>
<action>
<assert>
<description value="Confirm that the returned HTTP status is 201(Created)."/>
<direction value="response"/>
<response value="created"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<operation>
<type>
<system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
<code value="search"/>
</type>
<resource value="Procedure"/>
<description value="Search for the created Procedure by the unique identifier."/>
<accept value="json"/>
<contentType value="none"/>
<encodeRequestUrl value="true"/>
<params value="?identifier=${searchReferenceProcedureIdentifier}"/>
<responseId value="reference-procedure-response"/>
</operation>
</action>
<action>
<assert>
<description value="Confirm that the returned HTTP status is 200(OK)."/>
<response value="okay"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<operation>
<type>
<system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
<code value="delete"/>
</type>
<resource value="Provenance"/>
<description value="Delete operation to ensure the Provenance does not exist on the server."/>
<accept value="json"/>
<contentType value="none"/>
<encodeRequestUrl value="true"/>
<params value="?target=Procedure/${referenceProcedureResourceId}"/>
</operation>
</action>
<action>
<assert>
<description value="Confirm that the returned HTTP status is either 200(OK), 204(No Content) or 404(Not Found)."/>
<operator value="in"/>
<responseCode value="200,204,404"/>
<warningOnly value="false"/>
</assert>
</action>
</setup>
<test id="Step1-CreateNewProvenance">
<name value="Step1-CreateNewProvenance"/>
<description value="Create a new Provenance in JSON format where the server assigns the resource id. The expected response code is 201 (Created) with a content of either the created Provenance resource in JSON format, an OperationOutcome resource in JSON format or an empty payload."/>
<action>
<operation>
<type>
<system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
<code value="create"/>
</type>
<resource value="Provenance"/>
<description value="Create Provenance with server assigned resource ids."/>
<accept value="json"/>
<contentType value="json"/>
<destination value="1"/>
<encodeRequestUrl value="true"/>
<origin value="1"/>
<sourceId value="resource-create"/>
</operation>
</action>
<action>
<assert>
<description value="Confirm that the returned HTTP status is 201(Created)."/>
<direction value="response"/>
<response value="created"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-ruleset">
<extension url="rulesetId">
<valueId value="ruleset-versioning-headers"/>
</extension>
</extension>
<description value="Complex ruleset assertion to conditionally validate expected versioning HTTP Headers."/>
<direction value="response"/>
<warningOnly value="true"/>
</assert>
</action>
<action>
<assert>
<extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-ruleset">
<extension url="rulesetId">
<valueId value="ruleset-createok-headers-body"/>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertContentTypeMimeTypeIfBody"/>
</extension>
<extension url="param">
<extension url="name">
<valueString value="headerExpectedValue"/>
</extension>
<extension url="value">
<valueString value="application/fhir+json"/>
</extension>
</extension>
</extension>
</extension>
<description value="Complex ruleset assertion to conditionally validate expected create ok response HTTP Headers and body."/>
<direction value="response"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<operation>
<type>
<system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
<code value="search"/>
</type>
<resource value="Provenance"/>
<description value="Search for the created Provenance by the target."/>
<accept value="json"/>
<destination value="1"/>
<encodeRequestUrl value="true"/>
<origin value="1"/>
<params value="?target=${searchParamIdentifier}"/>
<responseId value="create-search-response"/>
</operation>
</action>
<action>
<assert>
<description value="Confirm that the returned HTTP status is 200(OK)."/>
<direction value="response"/>
<response value="okay"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<description value="Confirm that the returned content format is JSON ('application/fhir+json')."/>
<direction value="response"/>
<contentType value="json"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<description value="Confirm that the response payload contains the Bundle resource type."/>
<direction value="response"/>
<resource value="Bundle"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<description value="Validate that the returned resource conforms to the corresponding FHIR bundle profile."/>
<direction value="response"/>
<validateProfileId value="bundle-profile"/>
<warningOnly value="false"/>
</assert>
</action>
</test>
<test id="Step2-ReadProvenance">
<name value="Step2-ReadProvenance"/>
<description value="Read the Provenance in JSON format created in step 1. The expected response code is 200 (OK) with a content of the found Provenance resource in JSON format."/>
<action>
<operation>
<type>
<system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
<code value="read"/>
</type>
<resource value="Provenance"/>
<description value="Provenance read operation with HTTP Header Accept set to JSON format."/>
<accept value="json"/>
<destination value="1"/>
<encodeRequestUrl value="true"/>
<origin value="1"/>
<params value="/${createResourceId}"/>
<responseId value="create-read-response"/>
</operation>
</action>
<action>
<assert>
<description value="Confirm that the returned HTTP status is 200(OK)."/>
<direction value="response"/>
<response value="okay"/>
<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>
<extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-ruleset">
<extension url="rulesetId">
<valueId value="ruleset-versioning-headers"/>
</extension>
</extension>
<description value="Complex ruleset assertion to conditionally validate expected versioning HTTP Headers."/>
<direction value="response"/>
<warningOnly value="true"/>
</assert>
</action>
<action>
<assert>
<description value="Confirm that the returned resource type is Provenance."/>
<direction value="response"/>
<resource value="Provenance"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<description value="Validate that the returned resource conforms to the corresponding FHIR resource profile."/>
<direction value="response"/>
<validateProfileId value="resource-profile"/>
<warningOnly value="false"/>
</assert>
</action>
</test>
<test id="Step3-UpdateProvenance">
<name value="Step3-UpdateProvenance"/>
<description value="Update the Provenance created in step 1 in JSON format. The expected response code is 200 (OK) with a content of either the updated Provenance resource in JSON format, an OperationOutcome resource in JSON format or an empty payload."/>
<action>
<operation>
<type>
<system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
<code value="update"/>
</type>
<resource value="Provenance"/>
<description value="Provenance update operation with JSON content."/>
<accept value="json"/>
<contentType value="json"/>
<destination value="1"/>
<encodeRequestUrl value="true"/>
<origin value="1"/>
<params value="/${createResourceId}"/>
<sourceId value="resource-update"/>
</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>
<extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-ruleset">
<extension url="rulesetId">
<valueId value="ruleset-versioning-headers"/>
</extension>
</extension>
<description value="Complex ruleset assertion to conditionally validate expected versioning HTTP Headers."/>
<direction value="response"/>
<warningOnly value="true"/>
</assert>
</action>
<action>
<assert>
<extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-ruleset">
<extension url="rulesetId">
<valueId value="ruleset-updateok-headers-body"/>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertContentTypeMimeTypeIfBody"/>
</extension>
<extension url="param">
<extension url="name">
<valueString value="headerExpectedValue"/>
</extension>
<extension url="value">
<valueString value="application/fhir+json"/>
</extension>
</extension>
</extension>
</extension>
<description value="Complex ruleset assertion to conditionally validate expected update ok response HTTP Headers and body."/>
<direction value="response"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<operation>
<type>
<system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
<code value="read"/>
</type>
<resource value="Provenance"/>
<description value="Read the Provenance in order to verify the updated contents."/>
<accept value="json"/>
<destination value="1"/>
<encodeRequestUrl value="true"/>
<origin value="1"/>
<params value="/${createResourceId}"/>
<responseId value="resource-read"/>
</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 content format is JSON ('application/fhir+json')."/>
<direction value="response"/>
<contentType value="json"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<description value="Validate that the returned resource conforms to the corresponding FHIR resource profile."/>
<direction value="response"/>
<validateProfileId value="resource-profile"/>
<warningOnly value="false"/>
</assert>
</action>
</test>
<test id="Step4-ProvenanceHistoryInstance">
<name value="Step4-ProvenanceHistoryInstance"/>
<description value="Retrieve the updated Provenance instance's history in JSON format. The expected response code is 200 (OK) with a Bundle resource in JSON format of type history containing the created and updated versions of the Provenance."/>
<action>
<operation>
<!-- <type>
<system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
<code value="history"/>
</type> -->
<resource value="Provenance"/>
<description value="Retrieve the history for a single, known Provenance."/>
<accept value="json"/>
<destination value="1"/>
<encodeRequestUrl value="true"/>
<origin value="1"/>
<params value="/${createResourceId}/_history"/>
</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 content format is JSON ('application/fhir+json')."/>
<direction value="response"/>
<contentType value="json"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<description value="Confirm that the response payload contains the Bundle resource type."/>
<direction value="response"/>
<resource value="Bundle"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<description value="Validate that the returned resource conforms to the corresponding FHIR bundle profile."/>
<direction value="response"/>
<validateProfileId value="bundle-profile"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<description value="Confirm that the Bundle type is 'history'."/>
<direction value="response"/>
<operator value="equals"/>
<path value=".type"/>
<value value="history"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<description value="Confirm that there is more than one resource instance returned. There should be at least two from the create and update operations."/>
<direction value="response"/>
<expression value="Bundle.entry.count()"/>
<operator value="greaterThan"/>
<value value="1"/>
<warningOnly value="false"/>
</assert>
</action>
</test>
<test id="Step5-ProvenanceVersionRead">
<name value="Step5-ProvenanceVersionRead"/>
<description value="Retrieve a initially created version of a Provenance instance in JSON format. The expected response code, if versioning is supported, is 200 (OK) with a content of the updated Provenance resource in JSON format; if versioning is not supported, a 404 (Not Found) with an OperationOutcome resource in JSON format or an empty payload."/>
<action>
<operation>
<type>
<system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
<code value="vread"/>
</type>
<resource value="Provenance"/>
<description value="Retrieve initially created version of the Provenance instance."/>
<accept value="json"/>
<destination value="1"/>
<encodeRequestUrl value="true"/>
<origin value="1"/>
<params value="/${createResourceId}/_history/${createVersionId}"/>
</operation>
</action>
<action>
<assert>
<extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-ruleset">
<extension url="rulesetId">
<valueId value="ruleset-vreadok-headers-body-if-versioning"/>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertContentTypeMimeTypeIfBody"/>
</extension>
<extension url="param">
<extension url="name">
<valueString value="headerExpectedValue"/>
</extension>
<extension url="value">
<valueString value="application/fhir+json"/>
</extension>
</extension>
</extension>
</extension>
<description value="Complex ruleset assertion to conditionally validate expected vread ok response code, HTTP Headers and body."/>
<direction value="response"/>
<warningOnly value="false"/>
</assert>
</action>
</test>
<test id="Step6-ProvenanceSearchType">
<name value="Step6-ProvenanceSearchType"/>
<description value="Search for the Provenance resource associated (target) to the Procedure resource introduced in this test using search by Procedure + _revIncludes: Provenance:target The expected response code is 200 (OK) with a Bundle resource in JSON format of type history containing the found instances of the Provenance."/>
<action>
<operation>
<type>
<system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
<code value="search"/>
</type>
<resource value="Procedure"/>
<description value="Search for the Provenance associated to a Procedure resource as the target of the Provenance using revinclude."/>
<accept value="json"/>
<destination value="1"/>
<encodeRequestUrl value="true"/>
<origin value="1"/>
<params value="?_id=${referenceProcedureResourceId}&_revinclude=Provenance:target"/>
</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 content format is JSON ('application/fhir+json')."/>
<direction value="response"/>
<contentType value="json"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<description value="Confirm that the response payload contains the Bundle resource type."/>
<direction value="response"/>
<resource value="Bundle"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<description value="Validate that the returned resource conforms to the corresponding FHIR bundle profile."/>
<direction value="response"/>
<validateProfileId value="bundle-profile"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<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="Verify Provenance is returned"/>
<direction value="response"/>
<expression value="Bundle.entry.resource.as(Provenance).exists()"/>
<warningOnly value="false"/>
</assert>
</action>
</test>
<test id="Step7-ProvenanceDelete">
<name value="Step7-ProvenanceDelete"/>
<description value="Delete a Provenance instance in JSON format. The expected response is either a 200 (OK) with an optional OperationOutcome in JSON format or 204 (No Content) and the content is empty; i.e. no content."/>
<action>
<operation>
<type>
<system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
<code value="delete"/>
</type>
<resource value="Provenance"/>
<description value="Delete the Provenance instance."/>
<accept value="json"/>
<destination value="1"/>
<encodeRequestUrl value="true"/>
<origin value="1"/>
<params value="/${createResourceId}"/>
</operation>
</action>
<action>
<assert>
<description value="Confirm that the returned HTTP status is either 200(OK), 204(No Content) or 404(Not Found)."/>
<direction value="response"/>
<operator value="in"/>
<responseCode value="200,204,404"/>
<warningOnly value="false"/>
</assert>
</action>
<action>
<assert>
<extension url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-ruleset">
<extension url="rulesetId">
<valueId value="ruleset-deletevalid-headers-body"/>
</extension>
<extension url="rule">
<extension url="ruleId">
<valueId value="assertContentTypeMimeTypeIfBody"/>
</extension>
<extension url="param">
<extension url="name">
<valueString value="headerExpectedValue"/>
</extension>
<extension url="value">
<valueString value="application/fhir+json"/>
</extension>
</extension>
</extension>
</extension>
<description value="Complex ruleset assertion to conditionally validate expected delete ok response HTTP Headers and body."/>
<direction value="response"/>
<warningOnly value="false"/>
</assert>
</action>
</test>
</TestScript>