Touchstone FHIR Testing
2.0.0 - current International flag

Touchstone FHIR Testing v2.0.0. This is the current published version. For a full list of available versions, see the Directory of published versions

: TestScript Patient Read Not Found RuleSet With Param JSON Syntax Example - XML Representation

Active as of 2023-07-03

Raw xml | Download



<TestScript xmlns="http://hl7.org/fhir">
  <id value="patient-read-notfound-ruleset-with-param-json"/>
  <meta>
    <profile
             value="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript"/>
  </meta>
  <text>
    <status value="extensions"/>
    <div xmlns="http://www.w3.org/1999/xhtml"><p><b>Generated Narrative: TestScript</b><a name="patient-read-notfound-ruleset-with-param-json"> </a></p><div style="display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%"><p style="margin-bottom: 0px">Resource TestScript &quot;patient-read-notfound-ruleset-with-param-json&quot; </p><p style="margin-bottom: 0px">Profile: <a href="StructureDefinition-testscript.html">AEGIS Touchstone Testing TestScript Profile</a></p></div><blockquote><p><b>AEGIS Touchstone Testing TestScript Ruleset Extension</b></p><blockquote><p><b>url</b></p><code>rulesetId</code></blockquote><p><b>value</b>: RulesetPatientNotFound</p><blockquote><p><b>url</b></p><code>path</code></blockquote><p><b>value</b>: ../_reference/ruleset/RuleSet-NotFound-Groovy.xml</p><blockquote><p><b>url</b></p><code>rule</code></blockquote><blockquote><p><b>url</b></p><code>rule</code></blockquote><blockquote><p><b>url</b></p><code>rule</code></blockquote><blockquote><p><b>url</b></p><code>rule</code></blockquote></blockquote><p><b>url</b>: <code>http://touchstone.aegis.net/touchstone/fhir/testing/TestScript/patient-read-notfound-ruleset-with-param-json</code></p><p><b>version</b>: 2.0.0</p><p><b>name</b>: PatientReadNotFoundRulesetWithParamJson</p><p><b>status</b>: active</p><p><b>date</b>: 2023-07-03</p><p><b>publisher</b>: AEGIS.net, Inc.</p><p><b>contact</b>: AEGIS.net, Inc.: <a href="https://www.aegis.net">https://www.aegis.net</a>, Richard Ettema: <a href="mailto:mailto:richard.ettema@aegis.net">mailto:richard.ettema@aegis.net</a></p><p><b>description</b>: Demonstrate the use of a ruleset with a Patient read. The actual test is a read operation for a Patient in JSON format where the patient is not found and a ruleset is used to conditionally check the system under test to either skip or apply checks for HTTP response headers the payload content.</p><p><b>jurisdiction</b>: World <span style="background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki"> (m49.htm#001)</span></p><p><b>copyright</b>: (c) AEGIS.net, Inc. 2015+</p><p><b>profile</b>: <a href="http://hl7.org/fhir/StructureDefinition/Patient">http://hl7.org/fhir/StructureDefinition/Patient</a> &quot;Patient&quot;</p><h3>Variables</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Name</b></td><td><b>Description</b></td><td><b>Hint</b></td></tr><tr><td style="display: none">*</td><td>NotFoundPatientResourceId</td><td>Enter a Patient resource id that does not exist on the destination system.</td><td>[Not Found Resource Id]</td></tr></table><blockquote><p><b>test</b></p><blockquote><p><b>id</b></p>01-ReadNotFoundJSON</blockquote><p><b>name</b>: ReadNotFoundJSON</p><p><b>description</b>: Test the read operation for a known, not found (never existed) Patient resource instance. The expected HTTP response is 404 (Not Found) and optional content of an OperationOutcome resource in JSON format.</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>Accept</b></td><td><b>EncodeRequestUrl</b></td><td><b>Params</b></td></tr><tr><td style="display: none">*</td><td>Read (Details: http://terminology.hl7.org/CodeSystem/testscript-operation-codes code read = 'Read', stated as 'null')</td><td>Patient</td><td>Patient read operation for a known, not found (never existed) resource instance.</td><td>json</td><td>true</td><td>/${NotFoundPatientResourceId}</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Extension</b></td><td><b>Description</b></td><td><b>Direction</b></td><td><b>ResponseCode</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td/><td>Confirm that the returned HTTP status is 404(Not Found).</td><td>response</td><td>404</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>Extension</b></td><td><b>Description</b></td><td><b>Direction</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td/><td>Complex ruleset assertion to conditionally validate expected HTTP Headers and payload.</td><td>response</td><td>false</td></tr></table></blockquote></blockquote></div>
  </text>
  <extension
             url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-ruleset">
    <extension url="rulesetId">
      <valueId value="RulesetPatientNotFound"/>
    </extension>
    <extension url="path">
      <valueString value="../_reference/ruleset/RuleSet-NotFound-Groovy.xml"/>
    </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="assertResourceIfBody"/>
      </extension>
      <extension url="param">
        <extension url="name">
          <valueString value="resourceOperator"/>
        </extension>
        <extension url="value">
          <valueString value="equals"/>
        </extension>
      </extension>
      <extension url="param">
        <extension url="name">
          <valueString value="bodyOperator"/>
        </extension>
        <extension url="value">
          <valueString value="notEmpty"/>
        </extension>
      </extension>
    </extension>
  </extension>
  <url
       value="http://touchstone.aegis.net/touchstone/fhir/testing/TestScript/patient-read-notfound-ruleset-with-param-json"/>
  <version value="2.0.0"/>
  <name value="PatientReadNotFoundRulesetWithParamJson"/>
  <status value="active"/>
  <date value="2023-07-03"/>
  <publisher value="AEGIS.net, Inc."/>
  <contact>
    <name value="AEGIS.net, Inc."/>
    <telecom>
      <system value="url"/>
      <value value="https://www.aegis.net"/>
    </telecom>
  </contact>
  <contact>
    <name value="Richard Ettema"/>
    <telecom>
      <system value="email"/>
      <value value="mailto:richard.ettema@aegis.net"/>
    </telecom>
  </contact>
  <description
               value="Demonstrate the use of a ruleset with a Patient read. The actual test is a read operation for a Patient in JSON format where the patient is not found and a ruleset is used to conditionally check the system under test to either skip or apply checks for HTTP response headers the payload content."/>
  <jurisdiction>
    <coding>
      <system value="http://unstats.un.org/unsd/methods/m49/m49.htm"/>
      <code value="001"/>
      <display value="World"/>
    </coding>
  </jurisdiction>
  <copyright value="(c) AEGIS.net, Inc. 2015+"/>
  <profile id="patient-profile">
    <reference value="http://hl7.org/fhir/StructureDefinition/Patient"/>
  </profile>
  <variable>
    <name value="NotFoundPatientResourceId"/>
    <description
                 value="Enter a Patient resource id that does not exist on the destination system."/>
    <hint value="[Not Found Resource Id]"/>
  </variable>
  <test id="01-ReadNotFoundJSON">
    <name value="ReadNotFoundJSON"/>
    <description
                 value="Test the read operation for a known, not found (never existed) Patient resource instance. The expected HTTP response is 404 (Not Found) and optional content of an OperationOutcome resource in JSON format."/>
    <action>
      <operation>
        <type>
          <system
                  value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
          <code value="read"/>
        </type>
        <resource value="Patient"/>
        <description
                     value="Patient read operation for a known, not found (never existed) resource instance."/>
        <accept value="json"/>
        <encodeRequestUrl value="true"/>
        <params value="/${NotFoundPatientResourceId}"/>
      </operation>
    </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 404(Not Found)."/>
        <direction value="response"/>
        <responseCode value="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="RulesetPatientNotFound"/>
          </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 url="rule">
            <extension url="ruleId">
              <valueId value="assertResourceIfBody"/>
            </extension>
            <extension url="param">
              <extension url="name">
                <valueString value="resource"/>
              </extension>
              <extension url="value">
                <valueString value="OperationOutcome"/>
              </extension>
            </extension>
          </extension>
        </extension>
        <description
                     value="Complex ruleset assertion to conditionally validate expected HTTP Headers and payload."/>
        <direction value="response"/>
        <warningOnly value="false"/>
      </assert>
    </action>
  </test>
</TestScript>