http://hl7.org/fhir/StructureDefinition/TestScript|4.0.1

A structured set of tests against a FHIR server or client implementation to determine compliance against the FHIR specification.
description: A structured set of tests against a FHIR server or client implementation to determine compliance against the FHIR specification.
derivation: specialization
name: TestScript
type: TestScript
elements:
  description: {short: Natural language description of the test script, index: 10}
  date: {short: Date last changed, isSummary: true, index: 7}
  variable:
    constraint:
      tst-3: {human: 'Variable can only contain one of expression, headerField or path.', severity: error, expression: expression.empty() or headerField.empty() or path.empty()}
    short: Placeholder for evaluated elements
    array: true
    index: 38
    elements:
      name: {short: Descriptive name for this variable, index: 39}
      defaultValue: {short: 'Default, hard-coded, or user-defined value for this variable', index: 40}
      description: {short: Natural language description of the variable, index: 41}
      expression: {short: The FHIRPath expression against the fixture body, index: 42}
      headerField: {short: HTTP header field name for source, index: 43}
      hint: {short: Hint help text for default value to enter, index: 44}
      path: {short: XPath or JSONPath against the fixture body, index: 45}
      sourceId: {short: Fixture Id of source expression or headerField within this variable, index: 46}
    required: [name]
  publisher: {short: Name of the publisher (organization or individual), isSummary: true, index: 8}
  jurisdiction:
    short: Intended jurisdiction for test script (if applicable)
    array: true
    binding: {strength: extensible, valueSet: 'http://hl7.org/fhir/ValueSet/jurisdiction'}
    isSummary: true
    index: 12
  purpose: {short: Why this test script is defined, index: 13}
  name: {short: Name for this test script (computer friendly), isSummary: true, index: 3}
  useContext: {short: The context that the content is intended to support, array: true, isSummary: true, index: 11}
  copyright: {short: Use and/or publishing restrictions, index: 14}
  experimental: {short: 'For testing purposes, not real usage', isSummary: true, index: 6}
  title: {short: Name for this test script (human friendly), isSummary: true, index: 4}
  setup:
    short: A series of required setup operations before tests are executed
    index: 47
    elements:
      action:
        constraint:
          tst-1: {human: Setup action SHALL contain either an operation or assert but not both., severity: error, expression: operation.exists() xor assert.exists()}
        min: 1
        short: A setup operation or assert to perform
        array: true
        index: 48
        elements:
          operation:
            constraint:
              tst-7: {human: Setup operation SHALL contain either sourceId or targetId or params or url., severity: error, expression: sourceId.exists() or (targetId.count() + url.count() + params.count() = 1) or (type.code in ('capabilities' |'search' | 'transaction' | 'history'))}
            short: The setup operation to perform
            index: 49
            elements:
              description: {short: Tracking/reporting operation description, index: 53}
              method:
                short: delete | get | options | patch | post | put | head
                binding: {strength: required, valueSet: 'http://hl7.org/fhir/ValueSet/http-operations|4.0.1'}
                index: 58
              targetId: {short: 'Id of fixture used for extracting the [id],  [type], and [vid] for GET requests', index: 67}
              requestHeader:
                short: Each operation can have one or more header elements
                array: true
                index: 61
                elements:
                  field: {short: HTTP header field name, index: 62}
                  value: {short: HTTP headerfield value, index: 63}
                required: [value, field]
              params: {short: Explicitly defined path parameters, index: 60}
              type:
                short: The operation code type that will be executed
                binding: {strength: extensible, valueSet: 'http://hl7.org/fhir/ValueSet/testscript-operation-codes'}
                index: 50
              requestId: {short: Fixture Id of mapped request, index: 64}
              encodeRequestUrl: {short: Whether or not to send the request url in encoded format, index: 57}
              label: {short: Tracking/logging operation label, index: 52}
              resource:
                short: Resource type
                binding: {strength: required, valueSet: 'http://hl7.org/fhir/ValueSet/defined-types|4.0.1'}
                index: 51
              url: {short: Request URL, index: 68}
              origin: {short: Server initiating the request, index: 59}
              contentType:
                short: Mime type of the request payload contents, with charset etc.
                binding: {strength: required, valueSet: 'http://hl7.org/fhir/ValueSet/mimetypes|4.0.1'}
                index: 55
              sourceId: {short: Fixture Id of body for PUT and POST requests, index: 66}
              responseId: {short: Fixture Id of mapped response, index: 65}
              destination: {short: Server responding to the request, index: 56}
              accept:
                short: Mime type to accept in the payload of the response, with charset etc.
                binding: {strength: required, valueSet: 'http://hl7.org/fhir/ValueSet/mimetypes|4.0.1'}
                index: 54
            required: [encodeRequestUrl]
          assert:
            constraint:
              tst-12: {human: Setup action assert response and responseCode SHALL be empty when direction equals request, severity: error, expression: (response.empty() and responseCode.empty() and direction = 'request') or direction.empty() or direction = 'response'}
              tst-5: {human: Only a single assertion SHALL be present within setup action assert element., severity: error, expression: extension.exists() or (contentType.count() + expression.count() + headerField.count() + minimumId.count() + navigationLinks.count() + path.count() + requestMethod.count() + resource.count() + responseCode.count() + response.count()  + validateProfileId.count() <=1)}
              tst-10: {human: 'Setup action assert SHALL contain either compareToSourceId and compareToSourceExpression, compareToSourceId and compareToSourcePath or neither.', severity: error, expression: compareToSourceId.empty() xor (compareToSourceExpression.exists() or compareToSourcePath.exists())}
            short: The assertion to perform
            index: 69
            elements:
              response:
                short: okay | created | noContent | notModified | bad | forbidden | notFound | methodNotAllowed | conflict | gone | preconditionFailed | unprocessable
                binding: {strength: required, valueSet: 'http://hl7.org/fhir/ValueSet/assert-response-code-types|4.0.1'}
                index: 86
              description: {short: Tracking/reporting assertion description, index: 71}
              path: {short: XPath or JSONPath expression, index: 82}
              headerField: {short: HTTP header field name, index: 78}
              compareToSourceId: {short: Id of the source fixture to be evaluated, index: 73}
              expression: {short: The FHIRPath expression to be evaluated, index: 77}
              value: {short: The value to compare to, index: 90}
              warningOnly: {short: 'Will this assert produce a warning only on error?', index: 91}
              compareToSourceExpression: {short: The FHIRPath expression to evaluate against the source fixture, index: 74}
              label: {short: Tracking/logging assertion label, index: 70}
              resource:
                short: Resource type
                binding: {strength: required, valueSet: 'http://hl7.org/fhir/ValueSet/defined-types|4.0.1'}
                index: 85
              responseCode: {short: HTTP response code to test, index: 87}
              minimumId: {short: Fixture Id of minimum content resource, index: 79}
              operator:
                short: equals | notEquals | in | notIn | greaterThan | lessThan | empty | notEmpty | contains | notContains | eval
                binding: {strength: required, valueSet: 'http://hl7.org/fhir/ValueSet/assert-operator-codes|4.0.1'}
                index: 81
              contentType:
                short: Mime type to compare against the 'Content-Type' header
                binding: {strength: required, valueSet: 'http://hl7.org/fhir/ValueSet/mimetypes|4.0.1'}
                index: 76
              compareToSourcePath: {short: XPath or JSONPath expression to evaluate against the source fixture, index: 75}
              validateProfileId: {short: Profile Id of validation profile reference, index: 89}
              sourceId: {short: Fixture Id of source expression or headerField, index: 88}
              requestMethod:
                short: delete | get | options | patch | post | put | head
                binding: {strength: required, valueSet: 'http://hl7.org/fhir/ValueSet/http-operations|4.0.1'}
                index: 83
              requestURL: {short: Request URL comparison value, index: 84}
              direction:
                short: response | request
                binding: {strength: required, valueSet: 'http://hl7.org/fhir/ValueSet/assert-direction-codes|4.0.1'}
                index: 72
              navigationLinks: {short: 'Perform validation on navigation links?', index: 80}
            required: [warningOnly]
    required: [action]
  status:
    isModifier: true
    short: draft | active | retired | unknown
    binding: {strength: required, valueSet: 'http://hl7.org/fhir/ValueSet/publication-status|4.0.1'}
    isModifierReason: This is labeled as \"Is Modifier\" because applications should not use a retired {{title}} without due consideration
    isSummary: true
    index: 5
  url: {short: 'Canonical identifier for this test script, represented as a URI (globally unique)', isSummary: true, index: 0}
  identifier: {short: Additional identifier for the test script, isSummary: true, index: 1}
  origin:
    short: An abstract server representing a client or sender in a message exchange
    array: true
    index: 15
    elements:
      index: {short: The index of the abstract origin server starting at 1, index: 16}
      profile:
        short: FHIR-Client | FHIR-SDC-FormFiller
        meaningWhenMissing: FHIR-Client
        binding: {strength: extensible, valueSet: 'http://hl7.org/fhir/ValueSet/testscript-profile-origin-types'}
        index: 17
    required: [index, profile]
  fixture:
    short: Fixture in the test script - by reference (uri)
    array: true
    index: 33
    elements:
      autocreate: {short: Whether or not to implicitly create the fixture during setup, index: 34}
      autodelete: {short: Whether or not to implicitly delete the fixture during teardown, index: 35}
      resource: {short: Reference of the resource, index: 36}
    required: [autodelete, autocreate]
  version: {short: Business version of the test script, isSummary: true, index: 2}
  teardown:
    short: A series of required clean up steps
    index: 98
    elements:
      action:
        min: 1
        short: One or more teardown operations to perform
        array: true
        index: 99
        elements:
          operation:
            constraint:
              tst-9: {human: Teardown operation SHALL contain either sourceId or targetId or params or url., severity: error, expression: sourceId.exists() or (targetId.count() + url.count() + params.count() = 1) or (type.code in ('capabilities' | 'search' | 'transaction' | 'history'))}
            elementReference: ['http://hl7.org/fhir/StructureDefinition/TestScript', elements, setup, elements, action, elements, operation]
            short: The teardown operation to perform
            index: 100
        required: [operation]
    required: [action]
  contact: {short: Contact details for the publisher, array: true, isSummary: true, index: 9}
  metadata:
    constraint:
      tst-4: {human: TestScript metadata capability SHALL contain required or validated or both., severity: error, expression: capability.required.exists() or capability.validated.exists()}
    short: Required capability that is assumed to function correctly on the FHIR server being tested
    index: 21
    elements:
      link:
        short: Links to the FHIR specification
        array: true
        index: 22
        elements:
          url: {short: URL to the specification, index: 23}
          description: {short: Short description, index: 24}
        required: [url]
      capability:
        min: 1
        short: Capabilities  that are assumed to function correctly on the FHIR server being tested
        array: true
        index: 25
        elements:
          required: {short: 'Are the capabilities required?', index: 26}
          validated: {short: 'Are the capabilities validated?', index: 27}
          description: {short: The expected capabilities of the server, index: 28}
          origin: {short: Which origin server these requirements apply to, array: true, index: 29}
          destination: {short: Which server these requirements apply to, index: 30}
          link: {short: Links to the FHIR specification, array: true, index: 31}
          capabilities: {short: Required Capability Statement, index: 32}
        required: [capabilities, required, validated]
    required: [capability]
  destination:
    short: An abstract server representing a destination or receiver in a message exchange
    array: true
    index: 18
    elements:
      index: {short: The index of the abstract destination server starting at 1, index: 19}
      profile:
        short: FHIR-Server | FHIR-SDC-FormManager | FHIR-SDC-FormReceiver | FHIR-SDC-FormProcessor
        meaningWhenMissing: FHIR-Server
        binding: {strength: extensible, valueSet: 'http://hl7.org/fhir/ValueSet/testscript-profile-destination-types'}
        index: 20
    required: [index, profile]
  test:
    short: A test in this script
    array: true
    index: 92
    elements:
      name: {short: Tracking/logging name of this test, index: 93}
      description: {short: Tracking/reporting short description of the test, index: 94}
      action:
        constraint:
          tst-2: {human: Test action SHALL contain either an operation or assert but not both., severity: error, expression: operation.exists() xor assert.exists()}
        min: 1
        short: A test operation or assert to perform
        array: true
        index: 95
        elements:
          operation:
            constraint:
              tst-8: {human: Test operation SHALL contain either sourceId or targetId or params or url., severity: error, expression: sourceId.exists() or (targetId.count() + url.count() + params.count() = 1) or (type.code in ('capabilities' | 'search' | 'transaction' | 'history'))}
            elementReference: ['http://hl7.org/fhir/StructureDefinition/TestScript', elements, setup, elements, action, elements, operation]
            short: The setup operation to perform
            index: 96
          assert:
            constraint:
              tst-11: {human: 'Test action assert SHALL contain either compareToSourceId and compareToSourceExpression, compareToSourceId and compareToSourcePath or neither.', severity: error, expression: compareToSourceId.empty() xor (compareToSourceExpression.exists() or compareToSourcePath.exists())}
              tst-13: {human: Test action assert response and response and responseCode SHALL be empty when direction equals request, severity: error, expression: (response.empty() and responseCode.empty() and direction = 'request') or direction.empty() or direction = 'response'}
              tst-6: {human: Only a single assertion SHALL be present within test action assert element., severity: error, expression: extension.exists() or (contentType.count() + expression.count() + headerField.count() + minimumId.count() + navigationLinks.count() + path.count() + requestMethod.count() + resource.count() + responseCode.count() + response.count() + validateProfileId.count() <=1)}
            elementReference: ['http://hl7.org/fhir/StructureDefinition/TestScript', elements, setup, elements, action, elements, assert]
            short: The setup assertion to perform
            index: 97
    required: [action]
  profile: {short: Reference of the validation profile, array: true, index: 37}
class: resource
kind: resource
url: http://hl7.org/fhir/StructureDefinition/TestScript
base: http://hl7.org/fhir/StructureDefinition/DomainResource
version: 4.0.1
required: [url, name, status]