description: Base StructureDefinition for TestScript Resource
package_name: hl7.fhir.core
derivation: specialization
name: TestScript
type: TestScript
elements:
description: {type: markdown, short: Natural language description of the test script, comments: 'This description can be used to capture details such as why the test script was built, comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the module as conveyed in the text field of the resource itself. This item SHOULD be populated unless the information is available from context.', index: 10}
date: {short: Date this was last changed, comments: 'Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the test script. Additional specific dates may be added as extensions.', type: dateTime, isSummary: true, index: 9}
variable:
constraint:
inv-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
comments: Variables would be set based either on XPath/JsonPath expressions against fixtures (static and response), or headerField evaluations against response headers. If variable evaluates to nodelist or anything other than a primitive value, then test engine would report error. Variables would be used to perform clean replacements in "operation.params", "operation.requestHeader.value", and "operation.url" element values during operation calls and in "assert.value" during assertion evaluations. This limits the places that test engines would need to look for placeholders "${}". Variables are scoped to the whole script. They are NOT evaluated at declaration. They are evaluated by test engine when used for substitutions in "operation.params", "operation.requestHeader.value", and "operation.url" element values during operation calls and in "assert.value" during assertion evaluations. See example testscript-search.xml.
type: BackboneElement
array: true
index: 38
elements:
name: {type: string, short: Descriptive name for this variable, comments: 'Placeholders would contain the variable name wrapped in ${} in "operation.params", "operation.requestHeader.value", and "operation.url" elements. These placeholders would need to be replaced by the variable value before the operation is executed.', index: 39}
defaultValue: {type: string, short: 'Default, hard-coded, or user-defined value for this variable', comments: The purpose of this element is to allow for a pre-defined value that can be used as a default or as an override value. Test engines can optionally use this as a placeholder for user-defined execution time values., 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, comments: 'If headerField is defined, then the variable will be evaluated against the headers that sourceId is pointing to. If expression or path is defined, then the variable will be evaluated against the fixture body that sourceId is pointing to. It is an error to define any combination of expression, headerField and path.', index: 42}
headerField: {type: string, short: HTTP header field name for source, comments: 'If headerField is defined, then the variable will be evaluated against the headers that sourceId is pointing to. If path is defined, then the variable will be evaluated against the fixture body that sourceId is pointing to. It is an error to define both headerField and path.', 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, comments: 'If headerField is defined, then the variable will be evaluated against the headers that sourceId is pointing to. If expression or path is defined, then the variable will be evaluated against the fixture body that sourceId is pointing to. It is an error to define any combination of expression, headerField and path.', index: 45}
sourceId: {type: id, short: Fixture Id of source expression or headerField within this variable, comments: This can be a statically defined fixture (at the top of the testscript) or a dynamically set fixture created by responseId of the action.operation element., index: 46}
required: [name]
publisher: {short: Name of the publisher (Organization or individual), comments: 'Usually an organization, but may be an individual. The publisher (or steward) of the test script is the organization or individual primarily responsible for the maintenance and upkeep of the test script. This is not necessarily the same individual or organization that developed and initially authored the content. The publisher is the primary point of contact for questions or issues with the test script. This item SHOULD be populated unless the information is available from context.', type: string, isSummary: true, index: 7}
jurisdiction: {short: Intended jurisdiction for test script (if applicable), type: CodeableConcept, array: true, isSummary: true, index: 12}
purpose: {short: Why this test script is defined, comments: 'This element does not describe the usage of the test script (See, e.g, the comments element, or relatedArtifacts), rather it''s for traceability of ''''why'''' the resource is either needed or ''''why'''' it is defined as it is. This may be used to point to source materials or specifications that drove the structure of this test script.', type: markdown, index: 13}
name: {short: Name for this test script (Computer friendly), comments: The name is not expected to be globally unique. The name should be a simple alpha-numeric type name to ensure it is computable friendly., type: string, isSummary: true, index: 3}
rule:
type: BackboneElement
short: Assert rule used within the test script
comments: Each rule should be treated by test engines as one assertion regardless of how many assertions are contained within the external rule template. The impact of negative rule evaluation on test script execution is the same as an assertion failure which is descibed elsewhere in the TestScript resource.
array: true
index: 47
elements:
resource:
type: Reference
short: Assert rule resource reference
refers: ['http://hl7.org/fhir/StructureDefinition/Resource']
index: 48
param:
short: Rule parameter template
comments: The parameter value can be dynamic at runtime.
type: BackboneElement
array: true
index: 49
elements:
name: {type: string, short: Parameter name matching external assert rule parameter, comments: The external rule template would be looking for the parameter by this name., index: 50}
value: {type: string, short: Parameter value defined either explicitly or dynamically, comments: 'This value can be overwritten by the assert.rule.param.value i.e. TestScript.rule.param.value will be used if assert.rule.param.value is not specified. The param value can be a string-representation of a number, string, or boolean that is expected. Test engines do have to look for placeholders (${}) and replace the variable placeholders with the variable values at runtime before supplying this value to the external rule template.', index: 51}
required: [name]
required: [resource]
useContext: {short: Content intends to support these contexts, comments: 'When multiple usageContexts are specified, there is no expectation for whether all or any of the contexts apply.', type: UsageContext, array: true, isSummary: true, index: 11}
copyright: {short: Use and/or publishing restrictions, type: markdown, index: 14}
experimental: {isModifier: true, short: 'If for testing purposes, not real usage', comments: Allows filtering of test script that are appropriate for use vs. not., type: boolean, isSummary: true, index: 6}
title: {type: string, short: Name for this test script (Human friendly), isSummary: true, index: 4}
setup:
type: BackboneElement
short: A series of required setup operations before tests are executed
index: 59
elements:
action:
constraint:
inv-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
index: 60
comments: An action should contain either an operation or an assertion but not both. It can contain any number of variables.
type: BackboneElement
array: true
elements:
operation:
type: BackboneElement
short: The setup operation to perform
constraint:
inv-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: 61
elements:
description: {type: string, short: Tracking/reporting operation description, comments: This has no impact on the verification itself., index: 65}
targetId: {type: id, short: 'Id of fixture used for extracting the [id], [type], and [vid] for GET requests', comments: 'If "url" element is specified, then "targetId", "params", and "resource" elements will be ignored as "url" element will have everything needed for constructing the request url. If "params" element is specified, then "targetId" element is ignored. For FHIR operations that require a resource (e.g. "read" and "vread" operations), the "resource" element must be specified when "params" element is specified. If "url" and "params" elements are absent, then the request url will be constructed from "targetId" fixture if present. For "read" operation, the resource and id values will be extracted from "targetId" fixture and used to construct the url. For "vread" and "history" operations, the versionId value will also be used.', index: 78}
requestHeader:
type: BackboneElement
short: Each operation can have one ore more header elements
comments: 'This gives control to test-script writers to set headers explicitly based on test requirements. It will allow for testing using: - "If-Modified-Since" and "If-None-Match" headers. See http://build.fhir.org/http.html#2.1.0.5.1 - "If-Match" header. See http://build.fhir.org/http.html#2.1.0.11 - Conditional Create using "If-None-Exist". See http://build.fhir.org/http.html#2.1.0.13.1 - Invalid "Content-Type" header for negative testing. - etc.'
array: true
index: 72
elements:
field: {type: string, short: HTTP header field name, comments: 'If header element is specified, then field is required.', index: 73}
value: {type: string, short: HTTP headerfield value, comments: 'If header element is specified, then value is required. No conversions will be done by Test Engine e.g. "xml" to "application/fhir+xml". The values will be set in HTTP headers "as-is". Test engines do have to look for placeholders (${}) and replace the variable placeholders with the variable values at runtime before sending the request.', index: 74}
required: [value, field]
params: {type: string, short: Explicitly defined path parameters, comments: 'If "url" element is specified, then "targetId", "params", and "resource" elements will be ignored as "url" element will have everything needed for constructing the request url. If "params" element is specified, then "targetId" element is ignored. For FHIR operations that require a resource (e.g. "read" and "vread" operations), the "resource" element must be specified when "params" element is specified. If "url" and "params" elements are absent, then the request url will be constructed from "targetId" fixture if present. For "read" operation, the resource and id values will be extracted from "targetId" fixture and used to construct the url. For "vread" and "history" operations, the versionId value will also be used. Test engines would append whatever is specified for "params" to the URL after the resource type without tampering with the string (beyond encoding the URL for HTTP). The "params" element does not correspond exactly to "search parameters". Nor is it the "path". It corresponds to the part of the URL that comes after the [type] (when "resource" element is specified); e.g. It corresponds to "/[id]/_history/[vid] {?_format=[mime-type]}" in the following operation: GET [base]/[type]/[id]/_history/[vid] {?_format=[mime-type]} Test engines do have to look for placeholders (${}) and replace the variable placeholders with the variable values at runtime before sending the request.', index: 71}
type: {short: The operation code type that will be executed, comments: 'See http://build.fhir.org/http.html for list of server interactions.', type: Coding, index: 62}
requestId: {type: id, short: Fixture Id of mapped request, comments: 'If a requestId is supplied, then the resulting request (both headers and body) is mapped to the fixture ID (which may be entirely new and previously undeclared) designated by "requestId". If requestId is not specified, it is the Test Engine''s responsibility to store the request and use it as requestId in subsequent assertions when assertion path and/or headerField is specified and direction is equal to request and requestId is not specified.', index: 75}
encodeRequestUrl: {type: boolean, short: Whether or not to send the request url in encoded format, defaultValueBoolean: true, index: 69}
label: {type: string, short: Tracking/logging operation label, comments: This has no impact on the verification itself., index: 64}
resource: {short: Resource type, comments: 'If "url" element is specified, then "targetId", "params", and "resource" elements will be ignored as "url" element will have everything needed for constructing the request url. If "params" element is specified, then "targetId" element is ignored. For FHIR operations that require a resource (e.g. "read" and "vread" operations), the "resource" element must be specified when "params" element is specified. If "url" and "params" elements are absent, then the request url will be constructed from "targetId" fixture if present. For "read" operation, the resource and id values will be extracted from "targetId" fixture and used to construct the url. For "vread" and "history" operations, the versionId value will also be used.', type: code, index: 63}
url: {type: string, short: Request URL, comments: 'Used to set the request URL explicitly. If "url" element is defined, then "targetId", "resource", and "params" elements will be ignored. Test engines would use whatever is specified in "url" without tampering with the string (beyond encoding the URL for HTTP). Test engines do have to look for placeholders (${}) and replace the variable placeholders with the variable values at runtime before sending the request.', index: 79}
origin: {type: integer, short: Server initiating the request, comments: 'If absent, test engine will send the message. When present, test engine will not send the request message but will wait for the request message to be sent from this origin server.', index: 70}
contentType: {short: xml | json | ttl | none, comments: 'If this is specified, then test engine shall set the ''Content-Type'' header to the corresponding value. If ''xml'' is specified, then ''Content-Type'' header of ''application/fhir+xml'' will be set. If ''json'' is specified, then ''application/fhir+json'' will be used. If you''d like to explicitly set the ''Content-Type'' to some other value then use the ''requestHeader'' element.', type: code, meaningWhenMissing: xml, index: 67}
sourceId: {type: id, short: Fixture Id of body for PUT and POST requests, index: 77}
responseId: {type: id, short: Fixture Id of mapped response, comments: 'If a responseId is supplied, and the server responds, then the resulting response (both headers and body) is mapped to the fixture ID (which may be entirely new and previously undeclared) designated by "responseId". If responseId is not specified, it is the Test Engine''s responsibility to store the response and use it as sourceId in subsequent assertions when assertion path and/or headerField is specified and sourceId is not specified.', index: 76}
destination: {type: integer, short: Server responding to the request, comments: 'If multiple TestScript.destination elements are defined and operation.destination is undefined, test engine will error as it cannot determine what destination to use for the exchange.', index: 68}
accept: {short: xml | json | ttl | none, comments: 'If this is specified, then test engine shall set the ''Accept'' header to the corresponding value. If ''xml'' is specified, then ''Accept'' header of ''application/fhir+xml'' will be set. If ''json'' is specified, then ''application/fhir+json'' will be used. If you''d like to explicitly set the ''Accept'' to some other value then use the ''requestHeader'' element.', type: code, meaningWhenMissing: xml, index: 66}
assert:
constraint:
inv-5: {human: Only a single assertion SHALL be present within setup action assert element., severity: error, expression: contentType.count() + expression.count() + headerField.count() + minimumId.count() + navigationLinks.count() + path.count() + resource.count() + responseCode.count() + response.count() + rule.count() + ruleset.count() + validateProfileId.count() <=1}
inv-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())}
inv-12: {human: Setup 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'}
short: The assertion to perform
comments: In order to evaluate an assertion, the request, response, and results of the most recently executed operation must always be maintained by the test engine.
type: BackboneElement
index: 80
elements:
response: {short: okay | created | noContent | notModified | bad | forbidden | notFound | methodNotAllowed | conflict | gone | preconditionFailed | unprocessable, comments: 'This is a shorter way of achieving similar verifications via "assert.responseCode". If you need more control, then use "assert.responseCode" e.g. .', type: code, index: 96}
description: {type: string, short: Tracking/reporting assertion description, comments: This has no impact on the verification itself., index: 82}
path: {type: string, short: XPath or JSONPath expression, comments: 'If both "path" and a "fixtureId" are specified, then the path will be evaluated against the request or response body mapped to the fixtureId. If "path" is specified and a "fixtureId" is not, then the path will be evaluated against the response body of the last operation. Test engines are to store the request and response body and headers of the last operation at all times for subsequent assertions.', index: 93}
headerField: {type: string, short: HTTP header field name, comments: 'If "headerField" is specified then "value" must be specified. If "sourceId" is not specified, then "headerField" will be evaluated against the last operation''s response headers. Test engines are to keep track of the last operation''s response body and response headers.', index: 89}
compareToSourceId: {type: string, short: Id of the source fixture to be evaluated, index: 84}
expression: {type: string, short: The fhirpath expression to be evaluated, comments: 'If both "expression" and a "fixtureId" are specified, then the expression will be evaluated against the request or response body mapped to the fixtureId. If "expression" is specified and a "fixtureId" is not, then the expression will be evaluated against the response body of the last operation. Test engines are to store the request and response body and headers of the last operation at all times for subsequent assertions.', index: 88}
rule:
short: The reference to a TestScript.rule
comments: Each rule should get evaluated by test engines as one assertion regardless of how many assertions are contained within the external rule template. The impact of negative rule evaluation on test script execution is the same as an assertion failure which is descibed elsewhere in the TestScript resource.
type: BackboneElement
index: 98
elements:
ruleId: {type: id, short: Id of the TestScript.rule, index: 99}
param:
short: Rule parameter template
comments: The parameter value can be dynamic at runtime.
type: BackboneElement
array: true
index: 100
elements:
name: {type: string, short: Parameter name matching external assert rule parameter, comments: The external rule template would be looking for the parameter by this name., index: 101}
value: {type: string, short: Parameter value defined either explicitly or dynamically, comments: 'This value overwrites the value (if any) specified in TestScript.rule.param.value. The param value can be a string-representation of a number, string, or boolean that is expected. Test engines do have to look for placeholders (${}) and replace the variable placeholders with the variable values at runtime before supplying this value to the external rule template.', index: 102}
required: [name, value]
required: [ruleId]
value: {type: string, short: The value to compare to, comments: 'The string-representation of a number, string, or boolean that is expected. Test engines do have to look for placeholders (${}) and replace the variable placeholders with the variable values at runtime before comparing this value to the actual value.', index: 112}
warningOnly: {short: 'Will this assert produce a warning only on error?', comments: 'If this element is specified and it is true, then assertion failures can be logged by test engine but should not stop the test script execution from proceeding. There are likely cases where the spec is not clear on what should happen. If the spec says something is optional (maybe a response header for example), but a server doesn’t do it, we could choose to issue a warning.', type: boolean, defaultValueBoolean: false, index: 113}
compareToSourceExpression: {type: string, short: The fhirpath expression to evaluate against the source fixture, comments: Thefhirpath expression to be evaluated against the expected fixture to compare to. Ignored if "assert.value" is used. The evaluation will be done before the assertion is evaluated., index: 85}
label: {type: string, short: Tracking/logging assertion label, comments: This has no impact on the verification itself., index: 81}
resource: {short: Resource type, comments: 'This will be expected resource type in response body e.g. in read, vread, search, etc. See http://build.fhir.org/resourcelist.html for complete list of resource types; e.g. .', type: code, index: 95}
responseCode: {type: string, short: HTTP response code to test, comments: 'To be used with "operator" attribute value. Asserts that the response code equals this value if "operator" is not specified. If the operator is "in" or "notIn" then the responseCode would be a comma-separated list of values e.g. "200,201". Otherwise, it''s expected to be a numeric value. If "fixture" is not specified, then the "responseBodyId" value of the last operation is assumed.', index: 97}
minimumId: {type: string, short: Fixture Id of minimum content resource, comments: Asserts that the response contains all the element/content in another fixture pointed to by minimumId. This can be a statically defined fixture or one that is dynamically set via responseId., index: 90}
operator: {short: equals | notEquals | in | notIn | greaterThan | lessThan | empty | notEmpty | contains | notContains | eval, comments: 'Operators are useful especially for negative testing. If operator is not specified, then the "equals" operator is assumed; e.g. .', type: code, index: 92}
contentType: {short: xml | json | ttl | none, comments: 'If this is specified, then test engine shall confirm that the content-type of the last operation''s headers is set to this value. If "assert.sourceId" element is specified, then the evaluation will be done against the headers mapped to that sourceId (and not the last operation''s headers). If ''xml'' is specified, then ''Content-Type'' header of ''application/fhir+xml'' will be confirmed. If ''json'' is specified, then ''application/fhir+json'' will be used. If you''d like to have more control over the string, then use ''assert.headerField'' instead.', type: code, meaningWhenMissing: xml, index: 87}
compareToSourcePath: {type: string, short: XPath or JSONPath expression to evaluate against the source fixture, comments: The XPath or JSONPath expression to be evaluated against the expected fixture to compare to. Ignored if "assert.value" is used. The evaluation will be done before the assertion is evaluated., index: 86}
validateProfileId: {type: id, short: Profile Id of validation profile reference, comments: The ID of a Profile fixture. Asserts that the response is valid according to the Profile specified by validateProfileId., index: 111}
sourceId: {type: id, short: Fixture Id of source expression or headerField, comments: This can be a statically defined fixture (at the top of the testscript) or a dynamically set fixture created by responseId of the action.operation element., index: 110}
ruleset:
short: The reference to a TestScript.ruleset
comments: Each rule within a ruleset should get evaluated by test engines as a separate assertion. The impact of negative rule evaluation on test script execution is the same as an assertion failure which is descibed elsewhere in the TestScript resource. If the first rule within the ruleset results in a failed assertion, then test engines do not have to evaluate the rest of the rules within the ruleset.
type: BackboneElement
index: 103
elements:
rulesetId: {type: id, short: Id of the TestScript.ruleset, index: 104}
rule:
short: The referenced rule within the ruleset
comments: This qualifies each param name so that a parameter with the same name can be used differently by the different rules with the ruleset.
type: BackboneElement
array: true
index: 105
elements:
ruleId: {type: id, short: Id of referenced rule within the ruleset, index: 106}
param:
type: BackboneElement
short: Rule parameter template
comments: The parameter value can be dynamic at runtime.
array: true
index: 107
elements:
name: {type: string, short: Parameter name matching external assert ruleset rule parameter, comments: The external rule template would be looking for the parameter by this name., index: 108}
value: {type: string, short: Parameter value defined either explicitly or dynamically, comments: 'This value overwrites the value (if any) specified in TestScript.ruleset.rule.param.value. The param value can be a string-representation of a number, string, or boolean that is expected. Test engines do have to look for placeholders (${}) and replace the variable placeholders with the variable values at runtime before supplying this value to the external rule template.', index: 109}
required: [name, value]
required: [ruleId]
required: [rulesetId]
requestURL: {type: string, short: Request URL comparison value, comments: If "requestURL" is specified then it will be used in place of "value". The "requestURL" will evaluate against the last operation's full request URL path string., index: 94}
direction: {short: response | request, comments: 'If the direction is specified as "response" (the default), then the processing of this assert is against the received response message. If the direction is specified as "request", then the processing of this assert is against the sent request message.', type: code, index: 83}
navigationLinks: {type: boolean, short: 'Perform validation on navigation links?', comments: 'Asserts that the Bundle contains first, last, and next links.', index: 91}
required: [action]
status: {isModifier: true, short: draft | active | retired, comments: Allows filtering of test script that are appropriate for use vs. not., type: code, isSummary: true, index: 5}
url: {short: Logical uri to reference this test script (globally unique), comments: 'Can be a urn:uuid: or a urn:oid:, but real http: addresses are preferred.', type: uri, isSummary: true, index: 0}
identifier: {short: Additional identifier for the test script, comments: 'Typically, this is used for identifiers that can go in an HL7 v3 II data type - e.g. to identify this test script outside of FHIR, where the logical URL is not possible to use.', type: Identifier, isSummary: true, index: 1}
origin:
type: BackboneElement
short: An abstract server representing a client or sender in a message exchange
comments: The purpose of this element is to define the profile of an origin element used elsewhere in the script. Test engines could then use the origin-profile mapping to offer a filtered list of test systems that can serve as the sender for the interaction.
array: true
index: 15
elements:
index:
type: integer
short: The index of the abstract origin server starting at 1
comments: "A given origin index (e.g. 1) can appear only once in the list (e.g. Origin 1 cannot be specified twice ... once as FormFiller and and again as FormProcessor within the same script as that could get confusing during test configuration). \n\nDifferent origin indices could play the same actor in the same test script (e.g. You could have two different test systems acting as Form-Filler).\n\nThe origin indices provided elsewhere in the test script must be one of these origin indices."
index: 16
profile: {short: FHIR-Client | FHIR-SDC-FormFiller, comments: Must be a "sender"/"client" profile., type: Coding, meaningWhenMissing: FHIR-Client, 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, defaultValueBoolean: false, index: 34}
autodelete: {type: boolean, short: Whether or not to implicitly delete the fixture during teardown, defaultValueBoolean: false, index: 35}
resource:
short: Reference of the resource
refers: ['http://hl7.org/fhir/StructureDefinition/Resource']
comments: See http://build.fhir.org/resourcelist.html for complete list of resource types.
type: Reference
index: 36
version: {short: Business version of the test script, comments: There may be multiple different instances of a test script that have the same identifier but different versions., type: string, isSummary: true, index: 2}
teardown:
type: BackboneElement
short: A series of required clean up steps
index: 120
elements:
action:
min: 1
short: One or more teardown operations to perform
index: 121
comments: An action should contain either an operation or an assertion but not both. It can contain any number of variables.
type: BackboneElement
array: true
elements:
operation:
short: The teardown operation to perform
constraint:
inv-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: 122
required: [operation]
required: [action]
ruleset:
type: BackboneElement
short: Assert ruleset used within the test script
comments: Each rule within a ruleset should be treated by test engines as one assertion regardless of how many assertions are contained within the external rule template. The impact of negative rule evaluation on test script execution is the same as an assertion failure which is descibed elsewhere in the TestScript resource.
array: true
index: 52
elements:
resource:
type: Reference
short: Assert ruleset resource reference
refers: ['http://hl7.org/fhir/StructureDefinition/Resource']
index: 53
rule:
min: 1
short: The referenced rule within the ruleset
index: 54
comments: This qualifies each param name so that a parameter with the same name can be used differently by the different rules with the ruleset.
type: BackboneElement
array: true
elements:
ruleId: {type: id, short: Id of referenced rule within the ruleset, index: 55}
param:
short: Ruleset rule parameter template
comments: The parameter value can be dynamic at runtime.
type: BackboneElement
array: true
index: 56
elements:
name: {type: string, short: Parameter name matching external assert ruleset rule parameter, comments: The external rule template would be looking for the parameter by this name., index: 57}
value: {type: string, short: Parameter value defined either explicitly or dynamically, comments: 'This value can be overwritten by the assert.ruleset.rule.param.value i.e. TestScript.ruleset.rule.param.value will be used if assert.ruleset.rule.param.value is not specified. The param value can be a string-representation of a number, string, or boolean that is expected. Test engines do have to look for placeholders (${}) and replace the variable placeholders with the variable values at runtime before supplying this value to the external rule template.', index: 58}
required: [name]
required: [ruleId]
required: [resource, rule]
contact: {short: Contact details for the publisher, comments: 'May be a web site, an email address, a telephone number, etc.', type: ContactDetail, array: true, isSummary: true, index: 8}
metadata:
type: BackboneElement
short: Required capability that is assumed to function correctly on the FHIR server being tested
constraint:
inv-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:
min: 1
short: Capabilities that are assumed to function correctly on the FHIR server being tested
index: 25
comments: When the metadata capabilities section is defined at TestScript.metadata or at TestScript.setup.metadata, and the server's conformance statement does not contain the elements defined in the minimal conformance statement, then all the tests in the TestScript are skipped. When the metadata capabilities section is defined at TestScript.test.metadata and the server's conformance statement does not contain the elements defined in the minimal conformance statement, then only that test is skipped. The "metadata.capabilities.required" and "metadata.capabilities.validated" elements only indicate whether the capabilities are the primary focus of the test script or not. The do not impact the skipping logic. Capabilities whose "metadata.capabilities.validated" flag is true are the primary focus of the test script.
type: BackboneElement
array: true
elements:
required: {type: boolean, short: 'Are the capabilities required?', defaultValueBoolean: false, index: 26}
validated: {type: boolean, short: 'Are the capabilities validated?', defaultValueBoolean: false, 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:
short: Required Capability Statement
refers: ['http://hl7.org/fhir/StructureDefinition/CapabilityStatement']
comments: The conformance statement of the server has to contain at a minimum the contents of the reference pointed to by this element.
type: Reference
index: 32
required: [capabilities]
required: [capability]
destination:
type: BackboneElement
short: An abstract server representing a destination or receiver in a message exchange
comments: The purpose of this element is to define the profile of an destination element used elsewhere in the script. Test engines could then use the destination-profile mapping to offer a filtered list of test systems that can serve as the receiver for the interaction.
array: true
index: 18
elements:
index:
type: integer
short: The index of the abstract destination server starting at 1
comments: "A given destination index (e.g. 1) can appear only once in the list (e.g. Destination 1 cannot be specified twice ... once as Form-Manager and and again as Form-Processor within the same script as that could get confusing during test configuration). \n\nDifferent destination indices could play the same actor in the same test script (e.g. You could have two different test systems acting as Form-Manager).\n\nThe destination indices provided elsewhere in the test script must be one of these destination indices."
index: 19
profile: {short: FHIR-Server | FHIR-SDC-FormManager | FHIR-SDC-FormReceiver | FHIR-SDC-FormProcessor, comments: Must be a "receiver"/"server" profile., type: Coding, meaningWhenMissing: FHIR-Server, index: 20}
required: [index, profile]
test:
type: BackboneElement
short: A test in this script
array: true
index: 114
elements:
name: {type: string, short: Tracking/logging name of this test, index: 115}
description: {type: string, short: Tracking/reporting short description of the test, index: 116}
action:
constraint:
inv-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
index: 117
comments: An action should contain either an operation or an assertion but not both. It can contain any number of variables.
type: BackboneElement
array: true
elements:
operation:
short: The setup operation to perform
constraint:
inv-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: 118
assert:
constraint:
inv-6: {human: Only a single assertion SHALL be present within test action assert element., severity: error, expression: contentType.count() + expression.count() + headerField.count() + minimumId.count() + navigationLinks.count() + path.count() + resource.count() + responseCode.count() + response.count() + rule.count() + ruleset.count() + validateProfileId.count() <=1}
inv-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())}
inv-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'}
elementReference: ['http://hl7.org/fhir/StructureDefinition/TestScript', elements, setup, elements, action, elements, assert]
short: The setup assertion to perform
comments: In order to evaluate an assertion, the request, response, and results of the most recently executed operation must always be maintained by the test engine.
index: 119
required: [action]
profile:
short: Reference of the validation profile
refers: ['http://hl7.org/fhir/StructureDefinition/Resource']
comments: See http://build.fhir.org/resourcelist.html for complete list of resource types.
type: Reference
array: true
index: 37
package_version: 1.8.0
class: resource
kind: resource
url: http://hl7.org/fhir/StructureDefinition/TestScript
base: http://hl7.org/fhir/StructureDefinition/DomainResource
version: null
required: [url, name, status]