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