R4 Ballot #1 (Mixed Normative/Trial use) Current Build
This page was published as part of FHIR v3.3.0: R4 Ballot #1 : Mixed Normative/Trial use (First Normative ballot). It has been superceded by R4 . For a full list of available versions, see the Directory of published versions .

7.3 Resource TestScript - Content

FHIR Infrastructure Work Group Maturity Level : 2   Trial Use Security Category : Anonymous Compartments : Not linked to any defined compartments

A structured set of tests against a FHIR server or client implementation to determine compliance against the FHIR specification.

The TestScript resource is used to define tests that can be executed on one or more FHIR servers. The TestScript resource would typically contain

  • a list of fixtures (required resources used in the tests)
  • setup procedures
  • a suite of thematically related tests
  • teardown procedures

For example, one TestScript might feature a set of tests focusing on searching Patients and validating the Bundle responses. The fixtures for such a test would contain a list of Patient resources that are required for the test to complete successfully. The setup procedures create the fixtures on the FHIR server being tested. A series of tests execute various search parameters and search for the fixtures in the results. The teardown procedures would then clean up (delete) the fixtures on FHIR server that were created during the setup procedures.

The purpose of the TestScript is to encode in an executable representation tests that can be used to

  1. determine whether a given FHIR server adheres to the FHIR specification and
  2. determine whether two or more FHIR servers implement capabilities in a compatible or interoperable manner.
It might not be possible to fully automate the latter goal (especially with regards to business rules that might ride on top of different implementations), however the tests should be able to determine whether two servers support the operations, value sets, profiles, and extensions to exchange Bundles of Resources (such as returned from the Patient $everything operation ).

The TestScript resource should NOT be used to represent Clinical tests, Prescriptions, or any other Healthcare related concept. The TestScript resource is an infrastructure support resource used to represent standardized tests to determine an implementation's level of adherence to the FHIR specification.

TestScript is a part of the conformance framework and is used to validate the behavior of FHIR systems, specifically their correct implementation of StructureDefinition, ValueSet, OperationDefinition, CapabilityStatement and other FHIR resources that govern system behavior. TestScript instances may be included as part of ImplementationGuides to help define and test the desired behavior of systems that choose to comply with the implementation guide.

The following resources represent the FHIR conformance framework that are used to express the expected behavior of a FHIR compliant system:

The TestScript resource is designed to establish testing as a first class artifact within the FHIR specification. This resource allows defining a suite of tests that can be executed on one or more FHIR servers and clients.

Implementers should be familiar with the testing concepts and descriptions found in Testing FHIR before working with this resource.

This resource is referenced by testreport TestReport .

This resource does not implement any patterns.

Structure

rule 0..1 BackboneElement The reference to a TestScript.rule ruleId 1..1 id Id of the TestScript.rule param 0..* BackboneElement Rule parameter template name 1..1 string Parameter name matching external assert rule parameter value 1..1 string Parameter value defined either explicitly or dynamically ruleset 0..1 BackboneElement The reference to a TestScript.ruleset rulesetId 1..1 id Id of the TestScript.ruleset rule 0..* BackboneElement The referenced rule within the ruleset ruleId 1..1 id Id of referenced rule within the ruleset param 0..* BackboneElement Rule parameter template name 1..1 string Parameter name matching external assert ruleset rule parameter value 1..1 string Parameter value defined either explicitly or dynamically
Name Flags Card. Type Description & Constraints doco
. . TestScript I TU DomainResource Describes a set of tests
+ Warning: Name should be usable as an identifier for the module by machine processing applications such as code generation
Elements defined in Ancestors: id , meta , implicitRules , language , text , contained , extension , modifierExtension
. . . url Σ 1..1 uri Canonical identifier for this test script, represented as a URI (globally unique)
. . . identifier Σ 0..1 Identifier Additional identifier for the test script
. . . version Σ 0..1 string Business version of the test script
. . . name Σ I 1..1 string Name for this test script (computer friendly)
. . . title Σ 0..1 string Name for this test script (human friendly)
. . . status ?! Σ 1..1 code draft | active | retired | unknown
PublicationStatus ( Required )
. . . experimental ?! Σ 0..1 boolean For testing purposes, not real usage
. . . date Σ 0..1 dateTime Date last changed
. . . publisher Σ 0..1 string Name of the publisher (organization or individual)
. . . contact Σ 0..* ContactDetail Contact details for the publisher
. . . description 0..1 markdown Natural language description of the test script
. . . useContext Σ 0..* UsageContext The context that the content is intended to support
. . . jurisdiction Σ 0..* CodeableConcept Intended jurisdiction for test script (if applicable)
Jurisdiction ValueSet ( Extensible )
. . . purpose 0..1 markdown Why this test script is defined
. . . copyright 0..1 markdown Use and/or publishing restrictions
. . . origin 0..* BackboneElement An abstract server representing a client or sender in a message exchange
. . . . index 1..1 integer The index of the abstract origin server starting at 1
. . . . profile 1..1 Coding FHIR-Client | FHIR-SDC-FormFiller
TestScriptProfileOriginType Test script profile origin type ( Extensible )
. . . destination 0..* BackboneElement An abstract server representing a destination or receiver in a message exchange
. . . . index 1..1 integer The index of the abstract destination server starting at 1
. . . . profile 1..1 Coding FHIR-Server | FHIR-SDC-FormManager | FHIR-SDC-FormReceiver | FHIR-SDC-FormProcessor
TestScriptProfileDestinationType Test script profile destination type ( Extensible )
. . . metadata I 0..1 BackboneElement Required capability that is assumed to function correctly on the FHIR server being tested
+ Rule: TestScript metadata capability SHALL contain required or validated or both.
. . . . link 0..* BackboneElement Links to the FHIR specification
. . . . . url 1..1 uri URL to the specification
. . . . . description 0..1 string Short description
. . . . capability 1..* BackboneElement Capabilities that are assumed to function correctly on the FHIR server being tested
. . . . . required 1..1 boolean Are the capabilities required?
. . . . . validated 1..1 boolean Are the capabilities validated?
. . . . . description 0..1 string The expected capabilities of the server
. . . . . origin 0..* integer Which origin server these requirements apply to
. . . . . destination 0..1 integer Which server these requirements apply to
. . . . . link 0..* uri Links to the FHIR specification
. . . . . capabilities 1..1 canonical ( CapabilityStatement ) Required Capability Statement
. . . fixture 0..* BackboneElement Fixture in the test script - by reference (uri)
. . . . autocreate 1..1 boolean Whether or not to implicitly create the fixture during setup
. . . . autodelete 1..1 boolean Whether or not to implicitly delete the fixture during teardown
. . . . resource 0..1 Reference ( Any ) Reference of the resource
. . . profile 0..* Reference ( Any ) Reference of the validation profile
. . . variable I 0..* BackboneElement Placeholder for evaluated elements
+ Rule: Variable can only contain one of expression, headerField or path.
. . . . name 1..1 string Descriptive name for this variable
. . . . defaultValue 0..1 string Default, hard-coded, or user-defined value for this variable
. . . . description 0..1 string Natural language description of the variable
. . . . expression 0..1 string The FHIRPath expression against the fixture body
. . . . headerField 0..1 string HTTP header field name for source
. . . . hint 0..1 string Hint help text for default value to enter
. . . . path 0..1 string XPath or JSONPath against the fixture body
. . . . sourceId 0..1 id Fixture Id of source expression or headerField within this variable
. . . rule 0..* BackboneElement Assert rule used within the test script resource 1..1 Reference ( Any ) Assert rule resource reference param 0..* BackboneElement Rule parameter template name 1..1 string Parameter name matching external assert rule parameter value 0..1 string Parameter value defined either explicitly or dynamically ruleset 0..* BackboneElement Assert ruleset used within the test script resource 1..1 Reference ( Any ) Assert ruleset resource reference rule 1..* BackboneElement The referenced rule within the ruleset ruleId 1..1 id Id of referenced rule within the ruleset param 0..* BackboneElement Ruleset rule parameter template name 1..1 string Parameter name matching external assert ruleset rule parameter value 0..1 string Parameter value defined either explicitly or dynamically setup 0..1 BackboneElement A series of required setup operations before tests are executed
. . . . action I 1..* BackboneElement A setup operation or assert to perform
+ Rule: Setup action SHALL contain either an operation or assert but not both.
. . . . . operation I 0..1 BackboneElement The setup operation to perform
+ Rule: Setup operation SHALL contain either sourceId or targetId or params or url.
. . . . . . type 0..1 Coding The operation code type that will be executed
TestScriptOperationCode Test script operation code ( Extensible )
. . . . . . resource 0..1 code Resource type
FHIRDefinedType ( Required )
. . . . . . label 0..1 string Tracking/logging operation label
. . . . . . description 0..1 string Tracking/reporting operation description
. . . . . . accept 0..1 code Mime type to accept in the payload of the response, with charset etc.
MimeType ( Required )
. . . . . . contentType 0..1 code Mime type of the request payload contents, with charset etc.
MimeType ( Required )
. . . . . . destination 0..1 integer Server responding to the request
. . . . . . encodeRequestUrl 1..1 boolean Whether or not to send the request url in encoded format
. . . . . . method 0..1 code delete | get | options | patch | post | put | head
TestScriptRequestMethodCode ( Required )
...... origin 0..1 integer Server initiating the request
. . . . . . params 0..1 string Explicitly defined path parameters
. . . . . . requestHeader 0..* BackboneElement Each operation can have one or more header elements
. . . . . . . field 1..1 string HTTP header field name
. . . . . . . value 1..1 string HTTP headerfield value
. . . . . . requestId 0..1 id Fixture Id of mapped request
. . . . . . responseId 0..1 id Fixture Id of mapped response
. . . . . . sourceId 0..1 id Fixture Id of body for PUT and POST requests
. . . . . . targetId 0..1 id Id of fixture used for extracting the [id], [type], and [vid] for GET requests
. . . . . . url 0..1 string Request URL
. . . . . assert I 0..1 BackboneElement The assertion to perform
+ Rule: Only a single assertion SHALL be present within setup action assert element.
+ Rule: Setup action assert SHALL contain either compareToSourceId and compareToSourceExpression, compareToSourceId and compareToSourcePath or neither.
+ Rule: Setup action assert response and responseCode SHALL be empty when direction equals request
. . . . . . label 0..1 string Tracking/logging assertion label
. . . . . . description 0..1 string Tracking/reporting assertion description
. . . . . . direction 0..1 code response | request
AssertionDirectionType ( Required )
. . . . . . compareToSourceId 0..1 string Id of the source fixture to be evaluated
. . . . . . compareToSourceExpression 0..1 string The FHIRPath expression to evaluate against the source fixture
. . . . . . compareToSourcePath 0..1 string XPath or JSONPath expression to evaluate against the source fixture
. . . . . . contentType 0..1 code Mime type to compare against the 'Content-Type' header
MimeType ( Required )
. . . . . . expression 0..1 string The FHIRPath expression to be evaluated
. . . . . . headerField 0..1 string HTTP header field name
. . . . . . minimumId 0..1 string Fixture Id of minimum content resource
. . . . . . navigationLinks 0..1 boolean Perform validation on navigation links?
. . . . . . operator 0..1 code equals | notEquals | in | notIn | greaterThan | lessThan | empty | notEmpty | contains | notContains | eval
AssertionOperatorType ( Required )
. . . . . . path 0..1 string XPath or JSONPath expression
. . . . . . requestMethod 0..1 code delete | get | options | patch | post | put | head
TestScriptRequestMethodCode ( Required )
. . . . . . requestURL 0..1 string Request URL comparison value
. . . . . . resource 0..1 code Resource type
FHIRDefinedType ( Required )
. . . . . . response 0..1 code okay | created | noContent | notModified | bad | forbidden | notFound | methodNotAllowed | conflict | gone | preconditionFailed | unprocessable
AssertionResponseTypes ( Required )
. . . . . . responseCode 0..1 string HTTP response code to test
. . . . . . sourceId 0..1 id Fixture Id of source expression or headerField
. . . . . . validateProfileId 0..1 id Profile Id of validation profile reference
. . . . . . value 0..1 string The value to compare to
. . . . . . warningOnly 1..1 boolean Will this assert produce a warning only on error?
. . . test 0..* BackboneElement A test in this script
. . . . name 0..1 string Tracking/logging name of this test
. . . . description 0..1 string Tracking/reporting short description of the test
. . . . action I 1..* BackboneElement A test operation or assert to perform
+ Rule: Test action SHALL contain either an operation or assert but not both.
. . . . . operation I 0..1 see operation The setup operation to perform
+ Rule: Test operation SHALL contain either sourceId or targetId or params or url.
. . . . . assert I 0..1 see assert The setup assertion to perform
+ Rule: Only a single assertion SHALL be present within test action assert element.
+ Rule: Test action assert SHALL contain either compareToSourceId and compareToSourceExpression, compareToSourceId and compareToSourcePath or neither.
+ Rule: Test action assert response and response and responseCode SHALL be empty when direction equals request
. . . teardown 0..1 BackboneElement A series of required clean up steps
. . . . action 1..* BackboneElement One or more teardown operations to perform
. . . . . operation I 1..1 see operation The teardown operation to perform
+ Rule: Teardown operation SHALL contain either sourceId or targetId or params or url.

doco Documentation for this format

UML Diagram ( Legend )

TestScript ( DomainResource ) An absolute URI that is used to identify this test script when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this test script is (or will be) published published. This URL can be the target of a canonical reference. It SHALL remain the same when the test script is stored on different servers url : uri [1..1] A formal identifier that is used to identify this test script when it is represented in other formats, or referenced in a specification, model, design or an instance identifier : Identifier [0..1] The identifier that is used to identify this version of the test script when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the test script author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence version : string [0..1] A natural language name identifying the test script. This name should be usable as an identifier for the module by machine processing applications such as code generation name : string [1..1] A short, descriptive, user-friendly title for the test script title : string [0..1] The status of this test script. Enables tracking the life-cycle of the content (this element modifies the meaning of other elements) status : code [1..1] « The lifecycle status of an artifact. (Strength=Required) PublicationStatus ! » A Boolean value to indicate that this test script is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage (this element modifies the meaning of other elements) experimental : boolean [0..1] The date (and optionally time) when the test script was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the test script changes date : dateTime [0..1] The name of the organization or individual that published the test script publisher : string [0..1] Contact details to assist a user in finding and communicating with the publisher contact : ContactDetail [0..*] A free text natural language description of the test script from a consumer's perspective description : markdown [0..1] The content was developed with a focus and intent of supporting the contexts that are listed. These terms contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate test script instances useContext : UsageContext [0..*] A legal or geographic region in which the test script is intended to be used jurisdiction : CodeableConcept [0..*] « Countries and regions within which this artifact is targeted for use use. (Strength=Extensible) Jurisdiction ValueSet + » Explanation of why this test script is needed and why it has been designed as it has purpose : markdown [0..1] A copyright statement relating to the test script and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the test script copyright : markdown [0..1] Reference to the profile to be used for validation profile : Reference [0..*] « Any » Origin Abstract name given to an origin server in this test script. The name is provided as a number starting at 1 index : integer [1..1] The type of origin profile the test system supports profile : Coding [1..1] « The type of origin profile the test system supports. (Strength=Extensible) TestScriptProfileOriginType + » Destination Abstract name given to a destination server in this test script. The name is provided as a number starting at 1 index : integer [1..1] The type of destination profile the test system supports profile : Coding [1..1] « The type of destination profile the test system supports. (Strength=Extensible) TestScriptProfileDestinationT... + » Metadata Link URL to a particular requirement or feature within the FHIR specification url : uri [1..1] Short description of the link description : string [0..1] Capability Whether or not the test execution will require the given capabilities of the server in order for this test script to execute required : boolean [1..1] Whether or not the test execution will validate the given capabilities of the server in order for this test script to execute validated : boolean [1..1] Description of the capabilities that this test script is requiring the server to support description : string [0..1] Which origin server these requirements apply to origin : integer [0..*] Which server these requirements apply to destination : integer [0..1] Links to the FHIR specification that describes this interaction and the resources involved in more detail link : uri [0..*] Minimum capabilities required of server for test script to execute successfully. If server does not meet at a minimum the referenced capability statement, then all tests in this script are skipped capabilities : canonical [1..1] « CapabilityStatement » Fixture Whether or not to implicitly create the fixture during setup. If true, the fixture is automatically created on each server being tested during setup, therefore no create operation is required for this fixture in the TestScript.setup section autocreate : boolean [1..1] Whether or not to implicitly delete the fixture during teardown. If true, the fixture is automatically deleted on each server being tested during teardown, therefore no delete operation is required for this fixture in the TestScript.teardown section autodelete : boolean [1..1] Reference to the resource (containing the contents of the resource needed for operations) resource : Reference [0..1] « Any » Variable Descriptive name for this variable name : string [1..1] A default, hard-coded, or user-defined value for this variable defaultValue : string [0..1] A free text natural language description of the variable and its purpose description : string [0..1] The FHIRPath expression to evaluate against the fixture body. When variables are defined, only one of either expression, headerField or path must be specified expression : string [0..1] Will be used to grab the HTTP header field value from the headers that sourceId is pointing to headerField : string [0..1] Displayable text string with hint help information to the user when entering a default value hint : string [0..1] XPath or JSONPath to evaluate against the fixture body. When variables are defined, only one of either expression, headerField or path must be specified path : string [0..1] Fixture to evaluate the XPath/JSONPath expression or the headerField against within this variable sourceId : id [0..1] Rule Reference to the resource (containing the contents of the rule needed for assertions) resource : Reference [1..1] « Any » RuleParam Descriptive name for this parameter that matches the external assert rule parameter name name : string [1..1] The explicit or dynamic value for the parameter that will be passed on to the external rule template value : string [0..1] Setup Ruleset Reference to the resource (containing the contents of the ruleset needed for assertions) resource : Reference [1..1] « Any » RulesetRule Id of the referenced rule within the external ruleset template ruleId : id [1..1] RulesetRuleParam Descriptive name for this parameter that matches the external assert ruleset rule parameter name name : string [1..1] The value for the parameter that will be passed on to the external ruleset rule template value : string [0..1] SetupAction Setup SetupAction Operation Server interaction or operation type type : Coding [0..1] « The allowable operation code types. (Strength=Extensible) TestScriptOperationCode + » The type of the resource. See http://build.fhir.org/resourcelist.html resource : code [0..1] « A list of all the concrete types defined in this version of the FHIR specification - Data Types and Resource Types Types. (Strength=Required) FHIRDefinedType ! » The label would be used for tracking/logging purposes by test engines label : string [0..1] The description would be used by test engines for tracking and reporting purposes description : string [0..1] The mime-type to use for RESTful operation in the 'Accept' header accept : code [0..1] « The mime type of an attachment. Any valid mime type is allowed. (Strength=Required) MimeType Mime Types ! » The mime-type to use for RESTful operation in the 'Content-Type' header contentType : code [0..1] « The mime type of an attachment. Any valid mime type is allowed. (Strength=Required) MimeType Mime Types ! » The server where the request message is destined for. Must be one of the server numbers listed in TestScript.destination section destination : integer [0..1] Whether or not to implicitly send the request url in encoded format. The default is true to match the standard RESTful client behavior. Set to false when communicating with a server that does not support encoded url paths encodeRequestUrl : boolean [1..1] The HTTP method the test engine MUST use for this operation regardless of any other operation details method : code [0..1] « The allowable request method or HTTP operation codes. (Strength=Required) TestScriptRequestMethodCode ! » The server where the request message originates from. Must be one of the server numbers listed in TestScript.origin section origin : integer [0..1] Path plus parameters after [type]. Used to set parts of the request URL explicitly params : string [0..1] The fixture id (maybe new) to map to the request requestId : id [0..1] The fixture id (maybe new) to map to the response responseId : id [0..1] The id of the fixture used as the body of a PUT or POST request sourceId : id [0..1] Id of fixture used for extracting the [id], [type], and [vid] for GET requests targetId : id [0..1] Complete request URL url : string [0..1] RequestHeader The HTTP header field e.g. "Accept" field : string [1..1] The value of the header e.g. "application/fhir+xml" value : string [1..1] Assert The label would be used for tracking/logging purposes by test engines label : string [0..1] The description would be used by test engines for tracking and reporting purposes description : string [0..1] The direction to use for the assertion direction : code [0..1] « The type of direction to use for assertion. (Strength=Required) AssertionDirectionType ! » Id of the source fixture used as the contents to be evaluated by either the "source/expression" or "sourceId/path" definition compareToSourceId : string [0..1] The FHIRPath expression to evaluate against the source fixture. When compareToSourceId is defined, either compareToSourceExpression or compareToSourcePath must be defined, but not both compareToSourceExpression : string [0..1] XPath or JSONPath expression to evaluate against the source fixture. When compareToSourceId is defined, either compareToSourceExpression or compareToSourcePath must be defined, but not both compareToSourcePath : string [0..1] The mime-type contents to compare against the request or response message 'Content-Type' header contentType : code [0..1] « The mime type of an attachment. Any valid mime type is allowed. (Strength=Required) MimeType Mime Types ! » The FHIRPath expression to be evaluated against the request or response message contents - HTTP headers and payload expression : string [0..1] The HTTP header field name e.g. 'Location' headerField : string [0..1] The ID of a fixture. Asserts that the response contains at a minimum the fixture specified by minimumId minimumId : string [0..1] Whether or not the test execution performs validation on the bundle navigation links navigationLinks : boolean [0..1] The operator type defines the conditional behavior of the assert. If not defined, the default is equals operator : code [0..1] « The type of operator to use for assertion. (Strength=Required) AssertionOperatorType ! » The XPath or JSONPath expression to be evaluated against the fixture representing the response received from server path : string [0..1] The request method or HTTP operation code to compare against that used by the client system under test requestMethod : code [0..1] « The allowable request method or HTTP operation codes. (Strength=Required) TestScriptRequestMethodCode ! » The value to use in a comparison against the request URL path string requestURL : string [0..1] The type of the resource. See http://build.fhir.org/resourcelist.html resource : code [0..1] « A list of all the concrete types defined in this version of the FHIR specification - Data Types and Resource Types Types. (Strength=Required) FHIRDefinedType ! » okay | created | noContent | notModified | bad | forbidden | notFound | methodNotAllowed | conflict | gone | preconditionFailed | unprocessable response : code [0..1] « The type of response code to use for assertion. (Strength=Required) AssertionResponseTypes ! » The value of the HTTP response code to be tested responseCode : string [0..1] Fixture to evaluate the XPath/JSONPath expression or the headerField against sourceId : id [0..1] The ID of the Profile to validate against validateProfileId : id [0..1] The value to compare to value : string [0..1] Whether or not the test execution will produce a warning only on error for this assert warningOnly : boolean [1..1] ActionAssertRule The TestScript.rule id value this assert will evaluate ruleId : id [1..1] ActionAssertRuleParam Descriptive name for this parameter that matches the external assert rule parameter name name : string [1..1] The value for the parameter that will be passed on to the external rule template value : string [1..1] ActionAssertRuleset The TestScript.ruleset id value this assert will evaluate rulesetId : id [1..1] ActionAssertRulesetRule Id of the referenced rule within the external ruleset template ruleId : id [1..1] Param Descriptive name for this parameter that matches the external assert ruleset rule parameter name name : string [1..1] The value for the parameter that will be passed on to the external ruleset rule template value : string [1..1] Test The name of this test used for tracking/logging purposes by test engines name : string [0..1] A short description of the test used by test engines for tracking and reporting purposes description : string [0..1] TestAction Teardown TeardownAction An abstract server used in operations within this test script in the origin element origin [0..*] An abstract server used in operations within this test script in the destination element destination [0..*] A link to the FHIR specification that this test is covering link [0..*] Capabilities that must exist and are assumed to function correctly on the FHIR server being tested capability [1..*] The required capability must exist and are assumed to function correctly on the FHIR server being tested metadata [0..1] Fixture in the test script - by reference (uri). All fixtures are required for the test script to execute fixture [0..*] Variable is set based either on element value in response body or on header field value in the response headers variable [0..*] Each rule template can take one or more parameters for rule evaluation param [0..*] Assert rule to be used in one or more asserts within the test script rule [0..*] Each rule template can take one or more parameters for rule evaluation param [0..*] The referenced rule within the external ruleset template rule [1..*] Contains one or more rules. Offers a way to group rules so assertions could reference the group of rules and have them all applied ruleset [0..*] Header elements would be used to set HTTP headers requestHeader [0..*] The operation to perform operation [0..1] Each rule template can take one or more parameters for rule evaluation param [0..*] The TestScript.rule this assert will evaluate rule [0..1] Each rule template can take one or more parameters for rule evaluation param [0..*] The referenced rule within the external ruleset template rule [0..*] The TestScript.ruleset this assert will evaluate ruleset [0..1] Evaluates the results of previous operations to determine if the server under test behaves appropriately assert [0..1] Action would contain either an operation or an assertion action [1..*] A series of required setup operations before tests are executed setup [0..1] An operation would involve a REST request to a server operation [0..1] Evaluates the results of previous operations to determine if the server under test behaves appropriately assert [0..1] Action would contain either an operation or an assertion action [1..*] A test in this script test [0..*] An operation would involve a REST request to a server operation [1..1] The teardown action will only contain an operation action [1..*] A series of operations required to clean up after all the tests are executed (successfully or otherwise) teardown [0..1]

XML Template

<TestScript xmlns="http://hl7.org/fhir"> doco
 <!-- from Resource: id, meta, implicitRules, and language -->
 <!-- from DomainResource: text, contained, extension, and modifierExtension -->
 <

 <url value="[uri]"/><!-- 1..1 Canonical identifier for this test script, represented as a URI (globally unique) -->

 <identifier><!-- 0..1 Identifier Additional identifier for the test script --></identifier>
 <version value="[string]"/><!-- 0..1 Business version of the test script -->
 <

 <name value="[string]"/><!-- ?? 1..1 Name for this test script (computer friendly) -->

 <title value="[string]"/><!-- 0..1 Name for this test script (human friendly) -->
 <status value="[code]"/><!-- 1..1 draft | active | retired | unknown -->
 <

 <experimental value="[boolean]"/><!-- 0..1 For testing purposes, not real usage -->

 <date value="[dateTime]"/><!-- 0..1 Date last changed -->
 <publisher value="[string]"/><!-- 0..1 Name of the publisher (organization or individual) -->
 <contact><!-- 0..* ContactDetail Contact details for the publisher --></contact>
 <description value="[markdown]"/><!-- 0..1 Natural language description of the test script -->
 <</useContext>

 <useContext><!-- 0..* UsageContext The context that the content is intended to support --></useContext>

 <jurisdiction><!-- 0..* CodeableConcept Intended jurisdiction for test script (if applicable) --></jurisdiction>
 <purpose value="[markdown]"/><!-- 0..1 Why this test script is defined -->
 <copyright value="[markdown]"/><!-- 0..1 Use and/or publishing restrictions -->
 <origin>  <!-- 0..* An abstract server representing a client or sender in a message exchange -->
  <index value="[integer]"/><!-- 1..1 The index of the abstract origin server starting at 1 -->
  <profile><!-- 1..1 Coding FHIR-Client | FHIR-SDC-FormFiller --></profile>
 </origin>
 <destination>  <!-- 0..* An abstract server representing a destination or receiver in a message exchange -->
  <index value="[integer]"/><!-- 1..1 The index of the abstract destination server starting at 1 -->
  <profile><!-- 1..1 Coding FHIR-Server | FHIR-SDC-FormManager | FHIR-SDC-FormReceiver | FHIR-SDC-FormProcessor --></profile>
 </destination>
 <metadata>  <!-- 0..1 Required capability that is assumed to function correctly on the FHIR server being tested -->
  <link>  <!-- 0..* Links to the FHIR specification -->
   <url value="[uri]"/><!-- 1..1 URL to the specification -->
   <description value="[string]"/><!-- 0..1 Short description -->
  </link>
  <capability>  <!-- 1..* Capabilities  that are assumed to function correctly on the FHIR server being tested -->
   <required value="[boolean]"/><!-- 1..1 Are the capabilities required? -->
   <validated value="[boolean]"/><!-- 1..1 Are the capabilities validated? -->
   <description value="[string]"/><!-- 0..1 The expected capabilities of the server -->
   <origin value="[integer]"/><!-- 0..* Which origin server these requirements apply to -->
   <destination value="[integer]"/><!-- 0..1 Which server these requirements apply to -->
   <link value="[uri]"/><!-- 0..* Links to the FHIR specification -->
   <capabilities><!-- 1..1 canonical(CapabilityStatement) Required Capability Statement --></capabilities>
  </capability>
 </metadata>
 <fixture>  <!-- 0..* Fixture in the test script - by reference (uri) -->
  <autocreate value="[boolean]"/><!-- 1..1 Whether or not to implicitly create the fixture during setup -->
  <autodelete value="[boolean]"/><!-- 1..1 Whether or not to implicitly delete the fixture during teardown -->
  <resource><!-- 0..1 Reference(Any) Reference of the resource --></resource>
 </fixture>
 <profile><!-- 0..* Reference(Any) Reference of the validation profile --></profile>
 <variable>  <!-- 0..* Placeholder for evaluated elements -->
  <name value="[string]"/><!-- 1..1 Descriptive name for this variable -->
  <defaultValue value="[string]"/><!-- 0..1 Default, hard-coded, or user-defined value for this variable -->
  <description value="[string]"/><!-- 0..1 Natural language description of the variable -->
  <expression value="[string]"/><!-- 0..1 The FHIRPath expression against the fixture body -->
  <headerField value="[string]"/><!-- 0..1 HTTP header field name for source -->
  <hint value="[string]"/><!-- 0..1 Hint help text for default value to enter -->
  <path value="[string]"/><!-- 0..1 XPath or JSONPath against the fixture body -->
  <sourceId value="[id]"/><!-- 0..1 Fixture Id of source expression or headerField within this variable -->
 </variable>
 <
  <</resource>
  <
   <
   <
  </param>
 </rule>
 <
  <</resource>
  <
   <
   <
    <
    <
   </param>
  </rule>
 </ruleset>

 <setup>  <!-- 0..1 A series of required setup operations before tests are executed -->
  <action>  <!-- 1..* A setup operation or assert to perform -->
   <operation>  <!-- 0..1 The setup operation to perform -->
    <type><!-- 0..1 Coding The operation code type that will be executed --></type>
    <resource value="[code]"/><!-- 0..1 Resource type -->
    <label value="[string]"/><!-- 0..1 Tracking/logging operation label -->
    <description value="[string]"/><!-- 0..1 Tracking/reporting operation description -->
    <
    <

    <accept value="[code]"/><!-- 0..1 Mime type to accept in the payload of the response, with charset etc. -->
    <contentType value="[code]"/><!-- 0..1 Mime type of the request payload contents, with charset etc. -->

    <destination value="[integer]"/><!-- 0..1 Server responding to the request -->
    <encodeRequestUrl value="[boolean]"/><!-- 1..1 Whether or not to send the request url in encoded format -->
    <method value="[code]"/><!-- 0..1 delete | get | options | patch | post | put | head -->

    <origin value="[integer]"/><!-- 0..1 Server initiating the request -->
    <params value="[string]"/><!-- 0..1 Explicitly defined path parameters -->
    <requestHeader>  <!-- 0..* Each operation can have one or more header elements -->
     <field value="[string]"/><!-- 1..1 HTTP header field name -->
     <value value="[string]"/><!-- 1..1 HTTP headerfield value -->
    </requestHeader>
    <requestId value="[id]"/><!-- 0..1 Fixture Id of mapped request -->
    <responseId value="[id]"/><!-- 0..1 Fixture Id of mapped response -->
    <sourceId value="[id]"/><!-- 0..1 Fixture Id of body for PUT and POST requests -->
    <targetId value="[id]"/><!-- 0..1 Id of fixture used for extracting the [id],  [type], and [vid] for GET requests -->
    <url value="[string]"/><!-- 0..1 Request URL -->
   </operation>
   <assert>  <!-- 0..1 The assertion to perform -->
    <label value="[string]"/><!-- 0..1 Tracking/logging assertion label -->
    <description value="[string]"/><!-- 0..1 Tracking/reporting assertion description -->
    <direction value="[code]"/><!-- 0..1 response | request -->
    <compareToSourceId value="[string]"/><!-- 0..1 Id of the source fixture to be evaluated -->
    <compareToSourceExpression value="[string]"/><!-- 0..1 The FHIRPath expression to evaluate against the source fixture -->
    <compareToSourcePath value="[string]"/><!-- 0..1 XPath or JSONPath expression to evaluate against the source fixture -->
    <

    <contentType value="[code]"/><!-- 0..1 Mime type to compare against the 'Content-Type' header -->

    <expression value="[string]"/><!-- 0..1 The FHIRPath expression to be evaluated -->
    <headerField value="[string]"/><!-- 0..1 HTTP header field name -->
    <minimumId value="[string]"/><!-- 0..1 Fixture Id of minimum content resource -->
    <navigationLinks value="[boolean]"/><!-- 0..1 Perform validation on navigation links? -->
    <operator value="[code]"/><!-- 0..1 equals | notEquals | in | notIn | greaterThan | lessThan | empty | notEmpty | contains | notContains | eval -->
    <path value="[string]"/><!-- 0..1 XPath or JSONPath expression -->
    <

    <requestMethod value="[code]"/><!-- 0..1 delete | get | options | patch | post | put | head -->

    <requestURL value="[string]"/><!-- 0..1 Request URL comparison value -->
    <resource value="[code]"/><!-- 0..1 Resource type -->
    <response value="[code]"/><!-- 0..1 okay | created | noContent | notModified | bad | forbidden | notFound | methodNotAllowed | conflict | gone | preconditionFailed | unprocessable -->
    <responseCode value="[string]"/><!-- 0..1 HTTP response code to test -->
    <
     <
     <
      <
      <
     </param>
    </rule>
    <
     <
     <
      <
      <
       <
       <
      </param>
     </rule>
    </ruleset>

    <sourceId value="[id]"/><!-- 0..1 Fixture Id of source expression or headerField -->
    <validateProfileId value="[id]"/><!-- 0..1 Profile Id of validation profile reference -->
    <value value="[string]"/><!-- 0..1 The value to compare to -->
    <warningOnly value="[boolean]"/><!-- 1..1 Will this assert produce a warning only on error? -->
   </assert>
  </action>
 </setup>
 <test>  <!-- 0..* A test in this script -->
  <name value="[string]"/><!-- 0..1 Tracking/logging name of this test -->
  <description value="[string]"/><!-- 0..1 Tracking/reporting short description of the test -->
  <action>  <!-- 1..* A test operation or assert to perform -->
   <operation><!-- 0..1 Content as for TestScript.setup.action.operation The setup operation to perform --></operation>
   <assert><!-- 0..1 Content as for TestScript.setup.action.assert The setup assertion to perform --></assert>
  </action>
 </test>
 <teardown>  <!-- 0..1 A series of required clean up steps -->
  <action>  <!-- 1..* One or more teardown operations to perform -->
   <operation><!-- 1..1 Content as for TestScript.setup.action.operation The teardown operation to perform --></operation>
  </action>
 </teardown>
</TestScript>

JSON Template

{doco
  "resourceType" : "TestScript",
  // from Resource: id, meta, implicitRules, and language
  // from DomainResource: text, contained, extension, and modifierExtension
  "

  "url" : "<uri>", // R!  Canonical identifier for this test script, represented as a URI (globally unique)

  "identifier" : { Identifier }, // Additional identifier for the test script
  "version" : "<string>", // Business version of the test script
  "

  "name" : "<string>", // C? R!  Name for this test script (computer friendly)

  "title" : "<string>", // Name for this test script (human friendly)
  "status" : "<code>", // R!  draft | active | retired | unknown
  "

  "experimental" : <boolean>, // For testing purposes, not real usage

  "date" : "<dateTime>", // Date last changed
  "publisher" : "<string>", // Name of the publisher (organization or individual)
  "contact" : [{ ContactDetail }], // Contact details for the publisher
  "description" : "<markdown>", // Natural language description of the test script
  "

  "useContext" : [{ UsageContext }], // The context that the content is intended to support

  "jurisdiction" : [{ CodeableConcept }], // Intended jurisdiction for test script (if applicable)
  "purpose" : "<markdown>", // Why this test script is defined
  "copyright" : "<markdown>", // Use and/or publishing restrictions
  "origin" : [{ // An abstract server representing a client or sender in a message exchange
    "index" : <integer>, // R!  The index of the abstract origin server starting at 1
    "profile" : { Coding } // R!  FHIR-Client | FHIR-SDC-FormFiller
  }],
  "destination" : [{ // An abstract server representing a destination or receiver in a message exchange
    "index" : <integer>, // R!  The index of the abstract destination server starting at 1
    "profile" : { Coding } // R!  FHIR-Server | FHIR-SDC-FormManager | FHIR-SDC-FormReceiver | FHIR-SDC-FormProcessor
  }],
  "metadata" : { // Required capability that is assumed to function correctly on the FHIR server being tested
    "link" : [{ // Links to the FHIR specification
      "url" : "<uri>", // R!  URL to the specification
      "description" : "<string>" // Short description
    }],
    "capability" : [{ // R!  Capabilities  that are assumed to function correctly on the FHIR server being tested
      "required" : <boolean>, // R!  Are the capabilities required?
      "validated" : <boolean>, // R!  Are the capabilities validated?
      "description" : "<string>", // The expected capabilities of the server
      "origin" : [<integer>], // Which origin server these requirements apply to
      "destination" : <integer>, // Which server these requirements apply to
      "link" : ["<uri>"], // Links to the FHIR specification
      "

      "capabilities" : { canonical(CapabilityStatement) } // R!  Required Capability Statement

    }]
  },
  "fixture" : [{ // Fixture in the test script - by reference (uri)
    "autocreate" : <boolean>, // R!  Whether or not to implicitly create the fixture during setup
    "autodelete" : <boolean>, // R!  Whether or not to implicitly delete the fixture during teardown
    "resource" : { Reference(Any) } // Reference of the resource
  }],
  "profile" : [{ Reference(Any) }], // Reference of the validation profile
  "variable" : [{ // Placeholder for evaluated elements
    "name" : "<string>", // R!  Descriptive name for this variable
    "defaultValue" : "<string>", // Default, hard-coded, or user-defined value for this variable
    "description" : "<string>", // Natural language description of the variable
    "expression" : "<string>", // The FHIRPath expression against the fixture body
    "headerField" : "<string>", // HTTP header field name for source
    "hint" : "<string>", // Hint help text for default value to enter
    "path" : "<string>", // XPath or JSONPath against the fixture body
    "sourceId" : "<id>" // Fixture Id of source expression or headerField within this variable
  }],
  "
    "
    "
      "
      "
    }]
  }],
  "
    "
    "
      "
      "
        "
        "
      }]
    }]
  }],

  "setup" : { // A series of required setup operations before tests are executed
    "action" : [{ // R!  A setup operation or assert to perform
      "operation" : { // The setup operation to perform
        "type" : { Coding }, // The operation code type that will be executed
        "resource" : "<code>", // Resource type
        "label" : "<string>", // Tracking/logging operation label
        "description" : "<string>", // Tracking/reporting operation description
        "
        "

        "accept" : "<code>", // Mime type to accept in the payload of the response, with charset etc.
        "contentType" : "<code>", // Mime type of the request payload contents, with charset etc.

        "destination" : <integer>, // Server responding to the request
        "encodeRequestUrl" : <boolean>, // R!  Whether or not to send the request url in encoded format
        "method" : "<code>", // delete | get | options | patch | post | put | head

        "origin" : <integer>, // Server initiating the request
        "params" : "<string>", // Explicitly defined path parameters
        "requestHeader" : [{ // Each operation can have one or more header elements
          "field" : "<string>", // R!  HTTP header field name
          "value" : "<string>" // R!  HTTP headerfield value
        }],
        "requestId" : "<id>", // Fixture Id of mapped request
        "responseId" : "<id>", // Fixture Id of mapped response
        "sourceId" : "<id>", // Fixture Id of body for PUT and POST requests
        "targetId" : "<id>", // Id of fixture used for extracting the [id],  [type], and [vid] for GET requests
        "url" : "<string>" // Request URL
      },
      "assert" : { // The assertion to perform
        "label" : "<string>", // Tracking/logging assertion label
        "description" : "<string>", // Tracking/reporting assertion description
        "direction" : "<code>", // response | request
        "compareToSourceId" : "<string>", // Id of the source fixture to be evaluated
        "compareToSourceExpression" : "<string>", // The FHIRPath expression to evaluate against the source fixture
        "compareToSourcePath" : "<string>", // XPath or JSONPath expression to evaluate against the source fixture
        "

        "contentType" : "<code>", // Mime type to compare against the 'Content-Type' header

        "expression" : "<string>", // The FHIRPath expression to be evaluated
        "headerField" : "<string>", // HTTP header field name
        "minimumId" : "<string>", // Fixture Id of minimum content resource
        "navigationLinks" : <boolean>, // Perform validation on navigation links?
        "operator" : "<code>", // equals | notEquals | in | notIn | greaterThan | lessThan | empty | notEmpty | contains | notContains | eval
        "path" : "<string>", // XPath or JSONPath expression
        "

        "requestMethod" : "<code>", // delete | get | options | patch | post | put | head

        "requestURL" : "<string>", // Request URL comparison value
        "resource" : "<code>", // Resource type
        "response" : "<code>", // okay | created | noContent | notModified | bad | forbidden | notFound | methodNotAllowed | conflict | gone | preconditionFailed | unprocessable
        "responseCode" : "<string>", // HTTP response code to test
        "
          "
          "
            "
            "
          }]
        },
        "
          "
          "
            "
            "
              "
              "
            }]
          }]
        },

        "sourceId" : "<id>", // Fixture Id of source expression or headerField
        "validateProfileId" : "<id>", // Profile Id of validation profile reference
        "value" : "<string>", // The value to compare to
        "warningOnly" : <boolean> // R!  Will this assert produce a warning only on error?
      }
    }]
  },
  "test" : [{ // A test in this script
    "name" : "<string>", // Tracking/logging name of this test
    "description" : "<string>", // Tracking/reporting short description of the test
    "action" : [{ // R!  A test operation or assert to perform
      "operation" : { Content as for TestScript.setup.action.operation }, // The setup operation to perform
      "assert" : { Content as for TestScript.setup.action.assert } // The setup assertion to perform
    }]
  }],
  "teardown" : { // A series of required clean up steps
    "action" : [{ // R!  One or more teardown operations to perform
      "operation" : { Content as for TestScript.setup.action.operation } // R!  The teardown operation to perform
    }]
  }
}

Turtle Template

@prefix fhir: <http://hl7.org/fhir/> .doco
[ a fhir:TestScript;
  fhir:nodeRole fhir:treeRoot; # if this is the parser root
  # from Resource: .id, .meta, .implicitRules, and .language
  # from DomainResource: .text, .contained, .extension, and .modifierExtension
  fhir:

  fhir:TestScript.url [ uri ]; # 1..1 Canonical identifier for this test script, represented as a URI (globally unique)

  fhir:TestScript.identifier [ Identifier ]; # 0..1 Additional identifier for the test script
  fhir:TestScript.version [ string ]; # 0..1 Business version of the test script
  fhir:TestScript.name [ string ]; # 1..1 Name for this test script (computer friendly)
  fhir:TestScript.title [ string ]; # 0..1 Name for this test script (human friendly)
  fhir:TestScript.status [ code ]; # 1..1 draft | active | retired | unknown
  fhir:

  fhir:TestScript.experimental [ boolean ]; # 0..1 For testing purposes, not real usage

  fhir:TestScript.date [ dateTime ]; # 0..1 Date last changed
  fhir:TestScript.publisher [ string ]; # 0..1 Name of the publisher (organization or individual)
  fhir:TestScript.contact [ ContactDetail ], ... ; # 0..* Contact details for the publisher
  fhir:TestScript.description [ markdown ]; # 0..1 Natural language description of the test script
  fhir:

  fhir:TestScript.useContext [ UsageContext ], ... ; # 0..* The context that the content is intended to support

  fhir:TestScript.jurisdiction [ CodeableConcept ], ... ; # 0..* Intended jurisdiction for test script (if applicable)
  fhir:TestScript.purpose [ markdown ]; # 0..1 Why this test script is defined
  fhir:TestScript.copyright [ markdown ]; # 0..1 Use and/or publishing restrictions
  fhir:TestScript.origin [ # 0..* An abstract server representing a client or sender in a message exchange
    fhir:TestScript.origin.index [ integer ]; # 1..1 The index of the abstract origin server starting at 1
    fhir:TestScript.origin.profile [ Coding ]; # 1..1 FHIR-Client | FHIR-SDC-FormFiller
  ], ...;
  fhir:TestScript.destination [ # 0..* An abstract server representing a destination or receiver in a message exchange
    fhir:TestScript.destination.index [ integer ]; # 1..1 The index of the abstract destination server starting at 1
    fhir:TestScript.destination.profile [ Coding ]; # 1..1 FHIR-Server | FHIR-SDC-FormManager | FHIR-SDC-FormReceiver | FHIR-SDC-FormProcessor
  ], ...;
  fhir:TestScript.metadata [ # 0..1 Required capability that is assumed to function correctly on the FHIR server being tested
    fhir:TestScript.metadata.link [ # 0..* Links to the FHIR specification
      fhir:TestScript.metadata.link.url [ uri ]; # 1..1 URL to the specification
      fhir:TestScript.metadata.link.description [ string ]; # 0..1 Short description
    ], ...;
    fhir:TestScript.metadata.capability [ # 1..* Capabilities  that are assumed to function correctly on the FHIR server being tested
      fhir:TestScript.metadata.capability.required [ boolean ]; # 1..1 Are the capabilities required?
      fhir:TestScript.metadata.capability.validated [ boolean ]; # 1..1 Are the capabilities validated?
      fhir:TestScript.metadata.capability.description [ string ]; # 0..1 The expected capabilities of the server
      fhir:TestScript.metadata.capability.origin [ integer ], ... ; # 0..* Which origin server these requirements apply to
      fhir:TestScript.metadata.capability.destination [ integer ]; # 0..1 Which server these requirements apply to
      fhir:TestScript.metadata.capability.link [ uri ], ... ; # 0..* Links to the FHIR specification
      fhir:TestScript.metadata.capability.capabilities [ canonical(CapabilityStatement) ]; # 1..1 Required Capability Statement
    ], ...;
  ];
  fhir:TestScript.fixture [ # 0..* Fixture in the test script - by reference (uri)
    fhir:TestScript.fixture.autocreate [ boolean ]; # 1..1 Whether or not to implicitly create the fixture during setup
    fhir:TestScript.fixture.autodelete [ boolean ]; # 1..1 Whether or not to implicitly delete the fixture during teardown
    fhir:TestScript.fixture.resource [ Reference(Any) ]; # 0..1 Reference of the resource
  ], ...;
  fhir:TestScript.profile [ Reference(Any) ], ... ; # 0..* Reference of the validation profile
  fhir:TestScript.variable [ # 0..* Placeholder for evaluated elements
    fhir:TestScript.variable.name [ string ]; # 1..1 Descriptive name for this variable
    fhir:TestScript.variable.defaultValue [ string ]; # 0..1 Default, hard-coded, or user-defined value for this variable
    fhir:TestScript.variable.description [ string ]; # 0..1 Natural language description of the variable
    fhir:TestScript.variable.expression [ string ]; # 0..1 The FHIRPath expression against the fixture body
    fhir:TestScript.variable.headerField [ string ]; # 0..1 HTTP header field name for source
    fhir:TestScript.variable.hint [ string ]; # 0..1 Hint help text for default value to enter
    fhir:TestScript.variable.path [ string ]; # 0..1 XPath or JSONPath against the fixture body
    fhir:TestScript.variable.sourceId [ id ]; # 0..1 Fixture Id of source expression or headerField within this variable
  ], ...;
  fhir:
    fhir:
    fhir:
      fhir:
      fhir:
    ], ...;
  ], ...;
  fhir:
    fhir:
    fhir:
      fhir:
      fhir:
        fhir:
        fhir:
      ], ...;
    ], ...;
  ], ...;

  fhir:TestScript.setup [ # 0..1 A series of required setup operations before tests are executed
    fhir:TestScript.setup.action [ # 1..* A setup operation or assert to perform
      fhir:TestScript.setup.action.operation [ # 0..1 The setup operation to perform
        fhir:TestScript.setup.action.operation.type [ Coding ]; # 0..1 The operation code type that will be executed
        fhir:TestScript.setup.action.operation.resource [ code ]; # 0..1 Resource type
        fhir:TestScript.setup.action.operation.label [ string ]; # 0..1 Tracking/logging operation label
        fhir:TestScript.setup.action.operation.description [ string ]; # 0..1 Tracking/reporting operation description
        fhir:TestScript.setup.action.operation.accept [ code ]; # 0..1 Mime type to accept in the payload of the response, with charset etc.
        fhir:TestScript.setup.action.operation.contentType [ code ]; # 0..1 Mime type of the request payload contents, with charset etc.
        fhir:TestScript.setup.action.operation.destination [ integer ]; # 0..1 Server responding to the request
        fhir:TestScript.setup.action.operation.encodeRequestUrl [ boolean ]; # 1..1 Whether or not to send the request url in encoded format
        fhir:TestScript.setup.action.operation.method [ code ]; # 0..1 delete | get | options | patch | post | put | head

        fhir:TestScript.setup.action.operation.origin [ integer ]; # 0..1 Server initiating the request
        fhir:TestScript.setup.action.operation.params [ string ]; # 0..1 Explicitly defined path parameters
        fhir:TestScript.setup.action.operation.requestHeader [ # 0..* Each operation can have one or more header elements
          fhir:TestScript.setup.action.operation.requestHeader.field [ string ]; # 1..1 HTTP header field name
          fhir:TestScript.setup.action.operation.requestHeader.value [ string ]; # 1..1 HTTP headerfield value
        ], ...;
        fhir:TestScript.setup.action.operation.requestId [ id ]; # 0..1 Fixture Id of mapped request
        fhir:TestScript.setup.action.operation.responseId [ id ]; # 0..1 Fixture Id of mapped response
        fhir:TestScript.setup.action.operation.sourceId [ id ]; # 0..1 Fixture Id of body for PUT and POST requests
        fhir:TestScript.setup.action.operation.targetId [ id ]; # 0..1 Id of fixture used for extracting the [id],  [type], and [vid] for GET requests
        fhir:TestScript.setup.action.operation.url [ string ]; # 0..1 Request URL
      ];
      fhir:TestScript.setup.action.assert [ # 0..1 The assertion to perform
        fhir:TestScript.setup.action.assert.label [ string ]; # 0..1 Tracking/logging assertion label
        fhir:TestScript.setup.action.assert.description [ string ]; # 0..1 Tracking/reporting assertion description
        fhir:TestScript.setup.action.assert.direction [ code ]; # 0..1 response | request
        fhir:TestScript.setup.action.assert.compareToSourceId [ string ]; # 0..1 Id of the source fixture to be evaluated
        fhir:TestScript.setup.action.assert.compareToSourceExpression [ string ]; # 0..1 The FHIRPath expression to evaluate against the source fixture
        fhir:TestScript.setup.action.assert.compareToSourcePath [ string ]; # 0..1 XPath or JSONPath expression to evaluate against the source fixture
        fhir:TestScript.setup.action.assert.contentType [ code ]; # 0..1 Mime type to compare against the 'Content-Type' header
        fhir:TestScript.setup.action.assert.expression [ string ]; # 0..1 The FHIRPath expression to be evaluated
        fhir:TestScript.setup.action.assert.headerField [ string ]; # 0..1 HTTP header field name
        fhir:TestScript.setup.action.assert.minimumId [ string ]; # 0..1 Fixture Id of minimum content resource
        fhir:TestScript.setup.action.assert.navigationLinks [ boolean ]; # 0..1 Perform validation on navigation links?
        fhir:TestScript.setup.action.assert.operator [ code ]; # 0..1 equals | notEquals | in | notIn | greaterThan | lessThan | empty | notEmpty | contains | notContains | eval
        fhir:TestScript.setup.action.assert.path [ string ]; # 0..1 XPath or JSONPath expression
        fhir:

        fhir:TestScript.setup.action.assert.requestMethod [ code ]; # 0..1 delete | get | options | patch | post | put | head

        fhir:TestScript.setup.action.assert.requestURL [ string ]; # 0..1 Request URL comparison value
        fhir:TestScript.setup.action.assert.resource [ code ]; # 0..1 Resource type
        fhir:TestScript.setup.action.assert.response [ code ]; # 0..1 okay | created | noContent | notModified | bad | forbidden | notFound | methodNotAllowed | conflict | gone | preconditionFailed | unprocessable
        fhir:TestScript.setup.action.assert.responseCode [ string ]; # 0..1 HTTP response code to test
        fhir:
          fhir:
          fhir:
            fhir:
            fhir:
          ], ...;
        ];
        fhir:
          fhir:
          fhir:
            fhir:
            fhir:
              fhir:
              fhir:
            ], ...;
          ], ...;
        ];

        fhir:TestScript.setup.action.assert.sourceId [ id ]; # 0..1 Fixture Id of source expression or headerField
        fhir:TestScript.setup.action.assert.validateProfileId [ id ]; # 0..1 Profile Id of validation profile reference
        fhir:TestScript.setup.action.assert.value [ string ]; # 0..1 The value to compare to
        fhir:TestScript.setup.action.assert.warningOnly [ boolean ]; # 1..1 Will this assert produce a warning only on error?
      ];
    ], ...;
  ];
  fhir:TestScript.test [ # 0..* A test in this script
    fhir:TestScript.test.name [ string ]; # 0..1 Tracking/logging name of this test
    fhir:TestScript.test.description [ string ]; # 0..1 Tracking/reporting short description of the test
    fhir:TestScript.test.action [ # 1..* A test operation or assert to perform
      fhir:TestScript.test.action.operation [ See TestScript.setup.action.operation ]; # 0..1 The setup operation to perform
      fhir:TestScript.test.action.assert [ See TestScript.setup.action.assert ]; # 0..1 The setup assertion to perform
    ], ...;
  ], ...;
  fhir:TestScript.teardown [ # 0..1 A series of required clean up steps
    fhir:TestScript.teardown.action [ # 1..* One or more teardown operations to perform
      fhir:TestScript.teardown.action.operation [ See TestScript.setup.action.operation ]; # 1..1 The teardown operation to perform
    ], ...;
  ];
]

Changes since R3

TestScript
TestScript.metadata.capability.required TestScript.status
  • Min Cardinality changed Change value set from 0 http://hl7.org/fhir/ValueSet/publication-status|4.0.0 to 1 Default Value "false" removed http://hl7.org/fhir/ValueSet/publication-status|4.1.0
TestScript.metadata.capability.validated TestScript.setup.action.operation.resource
  • Min Cardinality changed Change value set from 0 http://hl7.org/fhir/ValueSet/defined-types|4.0.0 to 1 Default Value "false" removed http://hl7.org/fhir/ValueSet/defined-types|4.1.0
TestScript.metadata.capability.capabilities TestScript.setup.action.operation.accept
  • Type changed Change value set from Reference(CapabilityStatement) http://hl7.org/fhir/ValueSet/mimetypes|4.0.0 to canonical http://hl7.org/fhir/ValueSet/mimetypes|4.1.0
TestScript.fixture.autocreate TestScript.setup.action.operation.contentType
  • Min Cardinality changed Change value set from 0 http://hl7.org/fhir/ValueSet/mimetypes|4.0.0 to 1 Default Value "false" removed http://hl7.org/fhir/ValueSet/mimetypes|4.1.0
TestScript.fixture.autodelete TestScript.setup.action.operation.method
  • Min Cardinality changed Change value set from 0 http://hl7.org/fhir/ValueSet/http-operations|4.0.0 to 1 Default Value "false" removed http://hl7.org/fhir/ValueSet/http-operations|4.1.0
TestScript.setup.action.operation.accept TestScript.setup.action.assert.direction
  • Change value set from http://hl7.org/fhir/ValueSet/content-type http://hl7.org/fhir/ValueSet/assert-direction-codes|4.0.0 to http://www.rfc-editor.org/bcp/bcp13.txt http://hl7.org/fhir/ValueSet/assert-direction-codes|4.1.0
TestScript.setup.action.operation.contentType TestScript.setup.action.assert.contentType
  • Change value set from http://hl7.org/fhir/ValueSet/content-type http://hl7.org/fhir/ValueSet/mimetypes|4.0.0 to http://www.rfc-editor.org/bcp/bcp13.txt http://hl7.org/fhir/ValueSet/mimetypes|4.1.0
TestScript.setup.action.operation.encodeRequestUrl TestScript.setup.action.assert.operator
  • Min Cardinality changed Change value set from 0 http://hl7.org/fhir/ValueSet/assert-operator-codes|4.0.0 to 1 Default Value "true" removed http://hl7.org/fhir/ValueSet/assert-operator-codes|4.1.0
TestScript.setup.action.assert.contentType TestScript.setup.action.assert.requestMethod
  • Change value set from http://hl7.org/fhir/ValueSet/content-type http://hl7.org/fhir/ValueSet/http-operations|4.0.0 to http://www.rfc-editor.org/bcp/bcp13.txt http://hl7.org/fhir/ValueSet/http-operations|4.1.0
TestScript.setup.action.assert.warningOnly TestScript.setup.action.assert.resource
  • Min Cardinality changed Change value set from 0 http://hl7.org/fhir/ValueSet/defined-types|4.0.0 to 1 http://hl7.org/fhir/ValueSet/defined-types|4.1.0
TestScript.setup.action.assert.response
  • Default Value "false" removed Change value set from http://hl7.org/fhir/ValueSet/assert-response-code-types|4.0.0 to http://hl7.org/fhir/ValueSet/assert-response-code-types|4.1.0

See the Full Difference for further information

This analysis is available as XML or JSON .

See R2 <--> R3 <--> R4 Conversion Maps (status = 6 7 tests that all execute ok. 6 1 fail round-trip testing and 6 7 r3 resources are invalid (11 (0 errors). ). Note: these have note yet been updated to be R3 to R4 )

Structure

rule 0..1 BackboneElement The reference to a TestScript.rule ruleId 1..1 id Id of the TestScript.rule param 0..* BackboneElement Rule parameter template name 1..1 string Parameter name matching external assert rule parameter value 1..1 string Parameter value defined either explicitly or dynamically ruleset 0..1 BackboneElement The reference to a TestScript.ruleset rulesetId 1..1 id Id of the TestScript.ruleset rule 0..* BackboneElement The referenced rule within the ruleset ruleId 1..1 id Id of referenced rule within the ruleset param 0..* BackboneElement Rule parameter template name 1..1 string Parameter name matching external assert ruleset rule parameter value 1..1 string Parameter value defined either explicitly or dynamically
Name Flags Card. Type Description & Constraints doco
. . TestScript I TU DomainResource Describes a set of tests
+ Warning: Name should be usable as an identifier for the module by machine processing applications such as code generation
Elements defined in Ancestors: id , meta , implicitRules , language , text , contained , extension , modifierExtension
. . . url Σ 1..1 uri Canonical identifier for this test script, represented as a URI (globally unique)
. . . identifier Σ 0..1 Identifier Additional identifier for the test script
. . . version Σ 0..1 string Business version of the test script
. . . name Σ I 1..1 string Name for this test script (computer friendly)
. . . title Σ 0..1 string Name for this test script (human friendly)
. . . status ?! Σ 1..1 code draft | active | retired | unknown
PublicationStatus ( Required )
. . . experimental ?! Σ 0..1 boolean For testing purposes, not real usage
. . . date Σ 0..1 dateTime Date last changed
. . . publisher Σ 0..1 string Name of the publisher (organization or individual)
. . . contact Σ 0..* ContactDetail Contact details for the publisher
. . . description 0..1 markdown Natural language description of the test script
. . . useContext Σ 0..* UsageContext The context that the content is intended to support
. . . jurisdiction Σ 0..* CodeableConcept Intended jurisdiction for test script (if applicable)
Jurisdiction ValueSet ( Extensible )
. . . purpose 0..1 markdown Why this test script is defined
. . . copyright 0..1 markdown Use and/or publishing restrictions
. . . origin 0..* BackboneElement An abstract server representing a client or sender in a message exchange
. . . . index 1..1 integer The index of the abstract origin server starting at 1
. . . . profile 1..1 Coding FHIR-Client | FHIR-SDC-FormFiller
TestScriptProfileOriginType Test script profile origin type ( Extensible )
. . . destination 0..* BackboneElement An abstract server representing a destination or receiver in a message exchange
. . . . index 1..1 integer The index of the abstract destination server starting at 1
. . . . profile 1..1 Coding FHIR-Server | FHIR-SDC-FormManager | FHIR-SDC-FormReceiver | FHIR-SDC-FormProcessor
TestScriptProfileDestinationType Test script profile destination type ( Extensible )
. . . metadata I 0..1 BackboneElement Required capability that is assumed to function correctly on the FHIR server being tested
+ Rule: TestScript metadata capability SHALL contain required or validated or both.
. . . . link 0..* BackboneElement Links to the FHIR specification
. . . . . url 1..1 uri URL to the specification
. . . . . description 0..1 string Short description
. . . . capability 1..* BackboneElement Capabilities that are assumed to function correctly on the FHIR server being tested
. . . . . required 1..1 boolean Are the capabilities required?
. . . . . validated 1..1 boolean Are the capabilities validated?
. . . . . description 0..1 string The expected capabilities of the server
. . . . . origin 0..* integer Which origin server these requirements apply to
. . . . . destination 0..1 integer Which server these requirements apply to
. . . . . link 0..* uri Links to the FHIR specification
. . . . . capabilities 1..1 canonical ( CapabilityStatement ) Required Capability Statement
. . . fixture 0..* BackboneElement Fixture in the test script - by reference (uri)
. . . . autocreate 1..1 boolean Whether or not to implicitly create the fixture during setup
. . . . autodelete 1..1 boolean Whether or not to implicitly delete the fixture during teardown
. . . . resource 0..1 Reference ( Any ) Reference of the resource
. . . profile 0..* Reference ( Any ) Reference of the validation profile
. . . variable I 0..* BackboneElement Placeholder for evaluated elements
+ Rule: Variable can only contain one of expression, headerField or path.
. . . . name 1..1 string Descriptive name for this variable
. . . . defaultValue 0..1 string Default, hard-coded, or user-defined value for this variable
. . . . description 0..1 string Natural language description of the variable
. . . . expression 0..1 string The FHIRPath expression against the fixture body
. . . . headerField 0..1 string HTTP header field name for source
. . . . hint 0..1 string Hint help text for default value to enter
. . . . path 0..1 string XPath or JSONPath against the fixture body
. . . . sourceId 0..1 id Fixture Id of source expression or headerField within this variable
. . . rule 0..* BackboneElement Assert rule used within the test script resource 1..1 Reference ( Any ) Assert rule resource reference param 0..* BackboneElement Rule parameter template name 1..1 string Parameter name matching external assert rule parameter value 0..1 string Parameter value defined either explicitly or dynamically ruleset 0..* BackboneElement Assert ruleset used within the test script resource 1..1 Reference ( Any ) Assert ruleset resource reference rule 1..* BackboneElement The referenced rule within the ruleset ruleId 1..1 id Id of referenced rule within the ruleset param 0..* BackboneElement Ruleset rule parameter template name 1..1 string Parameter name matching external assert ruleset rule parameter value 0..1 string Parameter value defined either explicitly or dynamically setup 0..1 BackboneElement A series of required setup operations before tests are executed
. . . . action I 1..* BackboneElement A setup operation or assert to perform
+ Rule: Setup action SHALL contain either an operation or assert but not both.
. . . . . operation I 0..1 BackboneElement The setup operation to perform
+ Rule: Setup operation SHALL contain either sourceId or targetId or params or url.
. . . . . . type 0..1 Coding The operation code type that will be executed
TestScriptOperationCode Test script operation code ( Extensible )
. . . . . . resource 0..1 code Resource type
FHIRDefinedType ( Required )
. . . . . . label 0..1 string Tracking/logging operation label
. . . . . . description 0..1 string Tracking/reporting operation description
. . . . . . accept 0..1 code Mime type to accept in the payload of the response, with charset etc.
MimeType ( Required )
. . . . . . contentType 0..1 code Mime type of the request payload contents, with charset etc.
MimeType ( Required )
. . . . . . destination 0..1 integer Server responding to the request
. . . . . . encodeRequestUrl 1..1 boolean Whether or not to send the request url in encoded format
. . . . . . method 0..1 code delete | get | options | patch | post | put | head
TestScriptRequestMethodCode ( Required )
...... origin 0..1 integer Server initiating the request
. . . . . . params 0..1 string Explicitly defined path parameters
. . . . . . requestHeader 0..* BackboneElement Each operation can have one or more header elements
. . . . . . . field 1..1 string HTTP header field name
. . . . . . . value 1..1 string HTTP headerfield value
. . . . . . requestId 0..1 id Fixture Id of mapped request
. . . . . . responseId 0..1 id Fixture Id of mapped response
. . . . . . sourceId 0..1 id Fixture Id of body for PUT and POST requests
. . . . . . targetId 0..1 id Id of fixture used for extracting the [id], [type], and [vid] for GET requests
. . . . . . url 0..1 string Request URL
. . . . . assert I 0..1 BackboneElement The assertion to perform
+ Rule: Only a single assertion SHALL be present within setup action assert element.
+ Rule: Setup action assert SHALL contain either compareToSourceId and compareToSourceExpression, compareToSourceId and compareToSourcePath or neither.
+ Rule: Setup action assert response and responseCode SHALL be empty when direction equals request
. . . . . . label 0..1 string Tracking/logging assertion label
. . . . . . description 0..1 string Tracking/reporting assertion description
. . . . . . direction 0..1 code response | request
AssertionDirectionType ( Required )
. . . . . . compareToSourceId 0..1 string Id of the source fixture to be evaluated
. . . . . . compareToSourceExpression 0..1 string The FHIRPath expression to evaluate against the source fixture
. . . . . . compareToSourcePath 0..1 string XPath or JSONPath expression to evaluate against the source fixture
. . . . . . contentType 0..1 code Mime type to compare against the 'Content-Type' header
MimeType ( Required )
. . . . . . expression 0..1 string The FHIRPath expression to be evaluated
. . . . . . headerField 0..1 string HTTP header field name
. . . . . . minimumId 0..1 string Fixture Id of minimum content resource
. . . . . . navigationLinks 0..1 boolean Perform validation on navigation links?
. . . . . . operator 0..1 code equals | notEquals | in | notIn | greaterThan | lessThan | empty | notEmpty | contains | notContains | eval
AssertionOperatorType ( Required )
. . . . . . path 0..1 string XPath or JSONPath expression
. . . . . . requestMethod 0..1 code delete | get | options | patch | post | put | head
TestScriptRequestMethodCode ( Required )
. . . . . . requestURL 0..1 string Request URL comparison value
. . . . . . resource 0..1 code Resource type
FHIRDefinedType ( Required )
. . . . . . response 0..1 code okay | created | noContent | notModified | bad | forbidden | notFound | methodNotAllowed | conflict | gone | preconditionFailed | unprocessable
AssertionResponseTypes ( Required )
. . . . . . responseCode 0..1 string HTTP response code to test
. . . . . . sourceId 0..1 id Fixture Id of source expression or headerField
. . . . . . validateProfileId 0..1 id Profile Id of validation profile reference
. . . . . . value 0..1 string The value to compare to
. . . . . . warningOnly 1..1 boolean Will this assert produce a warning only on error?
. . . test 0..* BackboneElement A test in this script
. . . . name 0..1 string Tracking/logging name of this test
. . . . description 0..1 string Tracking/reporting short description of the test
. . . . action I 1..* BackboneElement A test operation or assert to perform
+ Rule: Test action SHALL contain either an operation or assert but not both.
. . . . . operation I 0..1 see operation The setup operation to perform
+ Rule: Test operation SHALL contain either sourceId or targetId or params or url.
. . . . . assert I 0..1 see assert The setup assertion to perform
+ Rule: Only a single assertion SHALL be present within test action assert element.
+ Rule: Test action assert SHALL contain either compareToSourceId and compareToSourceExpression, compareToSourceId and compareToSourcePath or neither.
+ Rule: Test action assert response and response and responseCode SHALL be empty when direction equals request
. . . teardown 0..1 BackboneElement A series of required clean up steps
. . . . action 1..* BackboneElement One or more teardown operations to perform
. . . . . operation I 1..1 see operation The teardown operation to perform
+ Rule: Teardown operation SHALL contain either sourceId or targetId or params or url.

doco Documentation for this format

UML Diagram ( Legend )

TestScript ( DomainResource ) An absolute URI that is used to identify this test script when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this test script is (or will be) published published. This URL can be the target of a canonical reference. It SHALL remain the same when the test script is stored on different servers url : uri [1..1] A formal identifier that is used to identify this test script when it is represented in other formats, or referenced in a specification, model, design or an instance identifier : Identifier [0..1] The identifier that is used to identify this version of the test script when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the test script author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence version : string [0..1] A natural language name identifying the test script. This name should be usable as an identifier for the module by machine processing applications such as code generation name : string [1..1] A short, descriptive, user-friendly title for the test script title : string [0..1] The status of this test script. Enables tracking the life-cycle of the content (this element modifies the meaning of other elements) status : code [1..1] « The lifecycle status of an artifact. (Strength=Required) PublicationStatus ! » A Boolean value to indicate that this test script is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage (this element modifies the meaning of other elements) experimental : boolean [0..1] The date (and optionally time) when the test script was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the test script changes date : dateTime [0..1] The name of the organization or individual that published the test script publisher : string [0..1] Contact details to assist a user in finding and communicating with the publisher contact : ContactDetail [0..*] A free text natural language description of the test script from a consumer's perspective description : markdown [0..1] The content was developed with a focus and intent of supporting the contexts that are listed. These terms contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate test script instances useContext : UsageContext [0..*] A legal or geographic region in which the test script is intended to be used jurisdiction : CodeableConcept [0..*] « Countries and regions within which this artifact is targeted for use use. (Strength=Extensible) Jurisdiction ValueSet + » Explanation of why this test script is needed and why it has been designed as it has purpose : markdown [0..1] A copyright statement relating to the test script and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the test script copyright : markdown [0..1] Reference to the profile to be used for validation profile : Reference [0..*] « Any » Origin Abstract name given to an origin server in this test script. The name is provided as a number starting at 1 index : integer [1..1] The type of origin profile the test system supports profile : Coding [1..1] « The type of origin profile the test system supports. (Strength=Extensible) TestScriptProfileOriginType + » Destination Abstract name given to a destination server in this test script. The name is provided as a number starting at 1 index : integer [1..1] The type of destination profile the test system supports profile : Coding [1..1] « The type of destination profile the test system supports. (Strength=Extensible) TestScriptProfileDestinationT... + » Metadata Link URL to a particular requirement or feature within the FHIR specification url : uri [1..1] Short description of the link description : string [0..1] Capability Whether or not the test execution will require the given capabilities of the server in order for this test script to execute required : boolean [1..1] Whether or not the test execution will validate the given capabilities of the server in order for this test script to execute validated : boolean [1..1] Description of the capabilities that this test script is requiring the server to support description : string [0..1] Which origin server these requirements apply to origin : integer [0..*] Which server these requirements apply to destination : integer [0..1] Links to the FHIR specification that describes this interaction and the resources involved in more detail link : uri [0..*] Minimum capabilities required of server for test script to execute successfully. If server does not meet at a minimum the referenced capability statement, then all tests in this script are skipped capabilities : canonical [1..1] « CapabilityStatement » Fixture Whether or not to implicitly create the fixture during setup. If true, the fixture is automatically created on each server being tested during setup, therefore no create operation is required for this fixture in the TestScript.setup section autocreate : boolean [1..1] Whether or not to implicitly delete the fixture during teardown. If true, the fixture is automatically deleted on each server being tested during teardown, therefore no delete operation is required for this fixture in the TestScript.teardown section autodelete : boolean [1..1] Reference to the resource (containing the contents of the resource needed for operations) resource : Reference [0..1] « Any » Variable Descriptive name for this variable name : string [1..1] A default, hard-coded, or user-defined value for this variable defaultValue : string [0..1] A free text natural language description of the variable and its purpose description : string [0..1] The FHIRPath expression to evaluate against the fixture body. When variables are defined, only one of either expression, headerField or path must be specified expression : string [0..1] Will be used to grab the HTTP header field value from the headers that sourceId is pointing to headerField : string [0..1] Displayable text string with hint help information to the user when entering a default value hint : string [0..1] XPath or JSONPath to evaluate against the fixture body. When variables are defined, only one of either expression, headerField or path must be specified path : string [0..1] Fixture to evaluate the XPath/JSONPath expression or the headerField against within this variable sourceId : id [0..1] Rule Reference to the resource (containing the contents of the rule needed for assertions) resource : Reference [1..1] « Any » RuleParam Descriptive name for this parameter that matches the external assert rule parameter name name : string [1..1] The explicit or dynamic value for the parameter that will be passed on to the external rule template value : string [0..1] Setup Ruleset Reference to the resource (containing the contents of the ruleset needed for assertions) resource : Reference [1..1] « Any » RulesetRule Id of the referenced rule within the external ruleset template ruleId : id [1..1] RulesetRuleParam Descriptive name for this parameter that matches the external assert ruleset rule parameter name name : string [1..1] The value for the parameter that will be passed on to the external ruleset rule template value : string [0..1] SetupAction Setup SetupAction Operation Server interaction or operation type type : Coding [0..1] « The allowable operation code types. (Strength=Extensible) TestScriptOperationCode + » The type of the resource. See http://build.fhir.org/resourcelist.html resource : code [0..1] « A list of all the concrete types defined in this version of the FHIR specification - Data Types and Resource Types Types. (Strength=Required) FHIRDefinedType ! » The label would be used for tracking/logging purposes by test engines label : string [0..1] The description would be used by test engines for tracking and reporting purposes description : string [0..1] The mime-type to use for RESTful operation in the 'Accept' header accept : code [0..1] « The mime type of an attachment. Any valid mime type is allowed. (Strength=Required) MimeType Mime Types ! » The mime-type to use for RESTful operation in the 'Content-Type' header contentType : code [0..1] « The mime type of an attachment. Any valid mime type is allowed. (Strength=Required) MimeType Mime Types ! » The server where the request message is destined for. Must be one of the server numbers listed in TestScript.destination section destination : integer [0..1] Whether or not to implicitly send the request url in encoded format. The default is true to match the standard RESTful client behavior. Set to false when communicating with a server that does not support encoded url paths encodeRequestUrl : boolean [1..1] The HTTP method the test engine MUST use for this operation regardless of any other operation details method : code [0..1] « The allowable request method or HTTP operation codes. (Strength=Required) TestScriptRequestMethodCode ! » The server where the request message originates from. Must be one of the server numbers listed in TestScript.origin section origin : integer [0..1] Path plus parameters after [type]. Used to set parts of the request URL explicitly params : string [0..1] The fixture id (maybe new) to map to the request requestId : id [0..1] The fixture id (maybe new) to map to the response responseId : id [0..1] The id of the fixture used as the body of a PUT or POST request sourceId : id [0..1] Id of fixture used for extracting the [id], [type], and [vid] for GET requests targetId : id [0..1] Complete request URL url : string [0..1] RequestHeader The HTTP header field e.g. "Accept" field : string [1..1] The value of the header e.g. "application/fhir+xml" value : string [1..1] Assert The label would be used for tracking/logging purposes by test engines label : string [0..1] The description would be used by test engines for tracking and reporting purposes description : string [0..1] The direction to use for the assertion direction : code [0..1] « The type of direction to use for assertion. (Strength=Required) AssertionDirectionType ! » Id of the source fixture used as the contents to be evaluated by either the "source/expression" or "sourceId/path" definition compareToSourceId : string [0..1] The FHIRPath expression to evaluate against the source fixture. When compareToSourceId is defined, either compareToSourceExpression or compareToSourcePath must be defined, but not both compareToSourceExpression : string [0..1] XPath or JSONPath expression to evaluate against the source fixture. When compareToSourceId is defined, either compareToSourceExpression or compareToSourcePath must be defined, but not both compareToSourcePath : string [0..1] The mime-type contents to compare against the request or response message 'Content-Type' header contentType : code [0..1] « The mime type of an attachment. Any valid mime type is allowed. (Strength=Required) MimeType Mime Types ! » The FHIRPath expression to be evaluated against the request or response message contents - HTTP headers and payload expression : string [0..1] The HTTP header field name e.g. 'Location' headerField : string [0..1] The ID of a fixture. Asserts that the response contains at a minimum the fixture specified by minimumId minimumId : string [0..1] Whether or not the test execution performs validation on the bundle navigation links navigationLinks : boolean [0..1] The operator type defines the conditional behavior of the assert. If not defined, the default is equals operator : code [0..1] « The type of operator to use for assertion. (Strength=Required) AssertionOperatorType ! » The XPath or JSONPath expression to be evaluated against the fixture representing the response received from server path : string [0..1] The request method or HTTP operation code to compare against that used by the client system under test requestMethod : code [0..1] « The allowable request method or HTTP operation codes. (Strength=Required) TestScriptRequestMethodCode ! » The value to use in a comparison against the request URL path string requestURL : string [0..1] The type of the resource. See http://build.fhir.org/resourcelist.html resource : code [0..1] « A list of all the concrete types defined in this version of the FHIR specification - Data Types and Resource Types Types. (Strength=Required) FHIRDefinedType ! » okay | created | noContent | notModified | bad | forbidden | notFound | methodNotAllowed | conflict | gone | preconditionFailed | unprocessable response : code [0..1] « The type of response code to use for assertion. (Strength=Required) AssertionResponseTypes ! » The value of the HTTP response code to be tested responseCode : string [0..1] Fixture to evaluate the XPath/JSONPath expression or the headerField against sourceId : id [0..1] The ID of the Profile to validate against validateProfileId : id [0..1] The value to compare to value : string [0..1] Whether or not the test execution will produce a warning only on error for this assert warningOnly : boolean [1..1] ActionAssertRule The TestScript.rule id value this assert will evaluate ruleId : id [1..1] ActionAssertRuleParam Descriptive name for this parameter that matches the external assert rule parameter name name : string [1..1] The value for the parameter that will be passed on to the external rule template value : string [1..1] ActionAssertRuleset The TestScript.ruleset id value this assert will evaluate rulesetId : id [1..1] ActionAssertRulesetRule Id of the referenced rule within the external ruleset template ruleId : id [1..1] Param Descriptive name for this parameter that matches the external assert ruleset rule parameter name name : string [1..1] The value for the parameter that will be passed on to the external ruleset rule template value : string [1..1] Test The name of this test used for tracking/logging purposes by test engines name : string [0..1] A short description of the test used by test engines for tracking and reporting purposes description : string [0..1] TestAction Teardown TeardownAction An abstract server used in operations within this test script in the origin element origin [0..*] An abstract server used in operations within this test script in the destination element destination [0..*] A link to the FHIR specification that this test is covering link [0..*] Capabilities that must exist and are assumed to function correctly on the FHIR server being tested capability [1..*] The required capability must exist and are assumed to function correctly on the FHIR server being tested metadata [0..1] Fixture in the test script - by reference (uri). All fixtures are required for the test script to execute fixture [0..*] Variable is set based either on element value in response body or on header field value in the response headers variable [0..*] Each rule template can take one or more parameters for rule evaluation param [0..*] Assert rule to be used in one or more asserts within the test script rule [0..*] Each rule template can take one or more parameters for rule evaluation param [0..*] The referenced rule within the external ruleset template rule [1..*] Contains one or more rules. Offers a way to group rules so assertions could reference the group of rules and have them all applied ruleset [0..*] Header elements would be used to set HTTP headers requestHeader [0..*] The operation to perform operation [0..1] Each rule template can take one or more parameters for rule evaluation param [0..*] The TestScript.rule this assert will evaluate rule [0..1] Each rule template can take one or more parameters for rule evaluation param [0..*] The referenced rule within the external ruleset template rule [0..*] The TestScript.ruleset this assert will evaluate ruleset [0..1] Evaluates the results of previous operations to determine if the server under test behaves appropriately assert [0..1] Action would contain either an operation or an assertion action [1..*] A series of required setup operations before tests are executed setup [0..1] An operation would involve a REST request to a server operation [0..1] Evaluates the results of previous operations to determine if the server under test behaves appropriately assert [0..1] Action would contain either an operation or an assertion action [1..*] A test in this script test [0..*] An operation would involve a REST request to a server operation [1..1] The teardown action will only contain an operation action [1..*] A series of operations required to clean up after all the tests are executed (successfully or otherwise) teardown [0..1]

XML Template

<TestScript xmlns="http://hl7.org/fhir"> doco
 <!-- from Resource: id, meta, implicitRules, and language -->
 <!-- from DomainResource: text, contained, extension, and modifierExtension -->
 <

 <url value="[uri]"/><!-- 1..1 Canonical identifier for this test script, represented as a URI (globally unique) -->

 <identifier><!-- 0..1 Identifier Additional identifier for the test script --></identifier>
 <version value="[string]"/><!-- 0..1 Business version of the test script -->
 <

 <name value="[string]"/><!-- ?? 1..1 Name for this test script (computer friendly) -->

 <title value="[string]"/><!-- 0..1 Name for this test script (human friendly) -->
 <status value="[code]"/><!-- 1..1 draft | active | retired | unknown -->
 <

 <experimental value="[boolean]"/><!-- 0..1 For testing purposes, not real usage -->

 <date value="[dateTime]"/><!-- 0..1 Date last changed -->
 <publisher value="[string]"/><!-- 0..1 Name of the publisher (organization or individual) -->
 <contact><!-- 0..* ContactDetail Contact details for the publisher --></contact>
 <description value="[markdown]"/><!-- 0..1 Natural language description of the test script -->
 <</useContext>

 <useContext><!-- 0..* UsageContext The context that the content is intended to support --></useContext>

 <jurisdiction><!-- 0..* CodeableConcept Intended jurisdiction for test script (if applicable) --></jurisdiction>
 <purpose value="[markdown]"/><!-- 0..1 Why this test script is defined -->
 <copyright value="[markdown]"/><!-- 0..1 Use and/or publishing restrictions -->
 <origin>  <!-- 0..* An abstract server representing a client or sender in a message exchange -->
  <index value="[integer]"/><!-- 1..1 The index of the abstract origin server starting at 1 -->
  <profile><!-- 1..1 Coding FHIR-Client | FHIR-SDC-FormFiller --></profile>
 </origin>
 <destination>  <!-- 0..* An abstract server representing a destination or receiver in a message exchange -->
  <index value="[integer]"/><!-- 1..1 The index of the abstract destination server starting at 1 -->
  <profile><!-- 1..1 Coding FHIR-Server | FHIR-SDC-FormManager | FHIR-SDC-FormReceiver | FHIR-SDC-FormProcessor --></profile>
 </destination>
 <metadata>  <!-- 0..1 Required capability that is assumed to function correctly on the FHIR server being tested -->
  <link>  <!-- 0..* Links to the FHIR specification -->
   <url value="[uri]"/><!-- 1..1 URL to the specification -->
   <description value="[string]"/><!-- 0..1 Short description -->
  </link>
  <capability>  <!-- 1..* Capabilities  that are assumed to function correctly on the FHIR server being tested -->
   <required value="[boolean]"/><!-- 1..1 Are the capabilities required? -->
   <validated value="[boolean]"/><!-- 1..1 Are the capabilities validated? -->
   <description value="[string]"/><!-- 0..1 The expected capabilities of the server -->
   <origin value="[integer]"/><!-- 0..* Which origin server these requirements apply to -->
   <destination value="[integer]"/><!-- 0..1 Which server these requirements apply to -->
   <link value="[uri]"/><!-- 0..* Links to the FHIR specification -->
   <capabilities><!-- 1..1 canonical(CapabilityStatement) Required Capability Statement --></capabilities>
  </capability>
 </metadata>
 <fixture>  <!-- 0..* Fixture in the test script - by reference (uri) -->
  <autocreate value="[boolean]"/><!-- 1..1 Whether or not to implicitly create the fixture during setup -->
  <autodelete value="[boolean]"/><!-- 1..1 Whether or not to implicitly delete the fixture during teardown -->
  <resource><!-- 0..1 Reference(Any) Reference of the resource --></resource>
 </fixture>
 <profile><!-- 0..* Reference(Any) Reference of the validation profile --></profile>
 <variable>  <!-- 0..* Placeholder for evaluated elements -->
  <name value="[string]"/><!-- 1..1 Descriptive name for this variable -->
  <defaultValue value="[string]"/><!-- 0..1 Default, hard-coded, or user-defined value for this variable -->
  <description value="[string]"/><!-- 0..1 Natural language description of the variable -->
  <expression value="[string]"/><!-- 0..1 The FHIRPath expression against the fixture body -->
  <headerField value="[string]"/><!-- 0..1 HTTP header field name for source -->
  <hint value="[string]"/><!-- 0..1 Hint help text for default value to enter -->
  <path value="[string]"/><!-- 0..1 XPath or JSONPath against the fixture body -->
  <sourceId value="[id]"/><!-- 0..1 Fixture Id of source expression or headerField within this variable -->
 </variable>
 <
  <</resource>
  <
   <
   <
  </param>
 </rule>
 <
  <</resource>
  <
   <
   <
    <
    <
   </param>
  </rule>
 </ruleset>

 <setup>  <!-- 0..1 A series of required setup operations before tests are executed -->
  <action>  <!-- 1..* A setup operation or assert to perform -->
   <operation>  <!-- 0..1 The setup operation to perform -->
    <type><!-- 0..1 Coding The operation code type that will be executed --></type>
    <resource value="[code]"/><!-- 0..1 Resource type -->
    <label value="[string]"/><!-- 0..1 Tracking/logging operation label -->
    <description value="[string]"/><!-- 0..1 Tracking/reporting operation description -->
    <
    <

    <accept value="[code]"/><!-- 0..1 Mime type to accept in the payload of the response, with charset etc. -->
    <contentType value="[code]"/><!-- 0..1 Mime type of the request payload contents, with charset etc. -->

    <destination value="[integer]"/><!-- 0..1 Server responding to the request -->
    <encodeRequestUrl value="[boolean]"/><!-- 1..1 Whether or not to send the request url in encoded format -->
    <method value="[code]"/><!-- 0..1 delete | get | options | patch | post | put | head -->

    <origin value="[integer]"/><!-- 0..1 Server initiating the request -->
    <params value="[string]"/><!-- 0..1 Explicitly defined path parameters -->
    <requestHeader>  <!-- 0..* Each operation can have one or more header elements -->
     <field value="[string]"/><!-- 1..1 HTTP header field name -->
     <value value="[string]"/><!-- 1..1 HTTP headerfield value -->
    </requestHeader>
    <requestId value="[id]"/><!-- 0..1 Fixture Id of mapped request -->
    <responseId value="[id]"/><!-- 0..1 Fixture Id of mapped response -->
    <sourceId value="[id]"/><!-- 0..1 Fixture Id of body for PUT and POST requests -->
    <targetId value="[id]"/><!-- 0..1 Id of fixture used for extracting the [id],  [type], and [vid] for GET requests -->
    <url value="[string]"/><!-- 0..1 Request URL -->
   </operation>
   <assert>  <!-- 0..1 The assertion to perform -->
    <label value="[string]"/><!-- 0..1 Tracking/logging assertion label -->
    <description value="[string]"/><!-- 0..1 Tracking/reporting assertion description -->
    <direction value="[code]"/><!-- 0..1 response | request -->
    <compareToSourceId value="[string]"/><!-- 0..1 Id of the source fixture to be evaluated -->
    <compareToSourceExpression value="[string]"/><!-- 0..1 The FHIRPath expression to evaluate against the source fixture -->
    <compareToSourcePath value="[string]"/><!-- 0..1 XPath or JSONPath expression to evaluate against the source fixture -->
    <

    <contentType value="[code]"/><!-- 0..1 Mime type to compare against the 'Content-Type' header -->

    <expression value="[string]"/><!-- 0..1 The FHIRPath expression to be evaluated -->
    <headerField value="[string]"/><!-- 0..1 HTTP header field name -->
    <minimumId value="[string]"/><!-- 0..1 Fixture Id of minimum content resource -->
    <navigationLinks value="[boolean]"/><!-- 0..1 Perform validation on navigation links? -->
    <operator value="[code]"/><!-- 0..1 equals | notEquals | in | notIn | greaterThan | lessThan | empty | notEmpty | contains | notContains | eval -->
    <path value="[string]"/><!-- 0..1 XPath or JSONPath expression -->
    <

    <requestMethod value="[code]"/><!-- 0..1 delete | get | options | patch | post | put | head -->

    <requestURL value="[string]"/><!-- 0..1 Request URL comparison value -->
    <resource value="[code]"/><!-- 0..1 Resource type -->
    <response value="[code]"/><!-- 0..1 okay | created | noContent | notModified | bad | forbidden | notFound | methodNotAllowed | conflict | gone | preconditionFailed | unprocessable -->
    <responseCode value="[string]"/><!-- 0..1 HTTP response code to test -->
    <
     <
     <
      <
      <
     </param>
    </rule>
    <
     <
     <
      <
      <
       <
       <
      </param>
     </rule>
    </ruleset>

    <sourceId value="[id]"/><!-- 0..1 Fixture Id of source expression or headerField -->
    <validateProfileId value="[id]"/><!-- 0..1 Profile Id of validation profile reference -->
    <value value="[string]"/><!-- 0..1 The value to compare to -->
    <warningOnly value="[boolean]"/><!-- 1..1 Will this assert produce a warning only on error? -->
   </assert>
  </action>
 </setup>
 <test>  <!-- 0..* A test in this script -->
  <name value="[string]"/><!-- 0..1 Tracking/logging name of this test -->
  <description value="[string]"/><!-- 0..1 Tracking/reporting short description of the test -->
  <action>  <!-- 1..* A test operation or assert to perform -->
   <operation><!-- 0..1 Content as for TestScript.setup.action.operation The setup operation to perform --></operation>
   <assert><!-- 0..1 Content as for TestScript.setup.action.assert The setup assertion to perform --></assert>
  </action>
 </test>
 <teardown>  <!-- 0..1 A series of required clean up steps -->
  <action>  <!-- 1..* One or more teardown operations to perform -->
   <operation><!-- 1..1 Content as for TestScript.setup.action.operation The teardown operation to perform --></operation>
  </action>
 </teardown>
</TestScript>

JSON Template

{doco
  "resourceType" : "TestScript",
  // from Resource: id, meta, implicitRules, and language
  // from DomainResource: text, contained, extension, and modifierExtension
  "

  "url" : "<uri>", // R!  Canonical identifier for this test script, represented as a URI (globally unique)

  "identifier" : { Identifier }, // Additional identifier for the test script
  "version" : "<string>", // Business version of the test script
  "

  "name" : "<string>", // C? R!  Name for this test script (computer friendly)

  "title" : "<string>", // Name for this test script (human friendly)
  "status" : "<code>", // R!  draft | active | retired | unknown
  "

  "experimental" : <boolean>, // For testing purposes, not real usage

  "date" : "<dateTime>", // Date last changed
  "publisher" : "<string>", // Name of the publisher (organization or individual)
  "contact" : [{ ContactDetail }], // Contact details for the publisher
  "description" : "<markdown>", // Natural language description of the test script
  "

  "useContext" : [{ UsageContext }], // The context that the content is intended to support

  "jurisdiction" : [{ CodeableConcept }], // Intended jurisdiction for test script (if applicable)
  "purpose" : "<markdown>", // Why this test script is defined
  "copyright" : "<markdown>", // Use and/or publishing restrictions
  "origin" : [{ // An abstract server representing a client or sender in a message exchange
    "index" : <integer>, // R!  The index of the abstract origin server starting at 1
    "profile" : { Coding } // R!  FHIR-Client | FHIR-SDC-FormFiller
  }],
  "destination" : [{ // An abstract server representing a destination or receiver in a message exchange
    "index" : <integer>, // R!  The index of the abstract destination server starting at 1
    "profile" : { Coding } // R!  FHIR-Server | FHIR-SDC-FormManager | FHIR-SDC-FormReceiver | FHIR-SDC-FormProcessor
  }],
  "metadata" : { // Required capability that is assumed to function correctly on the FHIR server being tested
    "link" : [{ // Links to the FHIR specification
      "url" : "<uri>", // R!  URL to the specification
      "description" : "<string>" // Short description
    }],
    "capability" : [{ // R!  Capabilities  that are assumed to function correctly on the FHIR server being tested
      "required" : <boolean>, // R!  Are the capabilities required?
      "validated" : <boolean>, // R!  Are the capabilities validated?
      "description" : "<string>", // The expected capabilities of the server
      "origin" : [<integer>], // Which origin server these requirements apply to
      "destination" : <integer>, // Which server these requirements apply to
      "link" : ["<uri>"], // Links to the FHIR specification
      "

      "capabilities" : { canonical(CapabilityStatement) } // R!  Required Capability Statement

    }]
  },
  "fixture" : [{ // Fixture in the test script - by reference (uri)
    "autocreate" : <boolean>, // R!  Whether or not to implicitly create the fixture during setup
    "autodelete" : <boolean>, // R!  Whether or not to implicitly delete the fixture during teardown
    "resource" : { Reference(Any) } // Reference of the resource
  }],
  "profile" : [{ Reference(Any) }], // Reference of the validation profile
  "variable" : [{ // Placeholder for evaluated elements
    "name" : "<string>", // R!  Descriptive name for this variable
    "defaultValue" : "<string>", // Default, hard-coded, or user-defined value for this variable
    "description" : "<string>", // Natural language description of the variable
    "expression" : "<string>", // The FHIRPath expression against the fixture body
    "headerField" : "<string>", // HTTP header field name for source
    "hint" : "<string>", // Hint help text for default value to enter
    "path" : "<string>", // XPath or JSONPath against the fixture body
    "sourceId" : "<id>" // Fixture Id of source expression or headerField within this variable
  }],
  "
    "
    "
      "
      "
    }]
  }],
  "
    "
    "
      "
      "
        "
        "
      }]
    }]
  }],

  "setup" : { // A series of required setup operations before tests are executed
    "action" : [{ // R!  A setup operation or assert to perform
      "operation" : { // The setup operation to perform
        "type" : { Coding }, // The operation code type that will be executed
        "resource" : "<code>", // Resource type
        "label" : "<string>", // Tracking/logging operation label
        "description" : "<string>", // Tracking/reporting operation description
        "
        "

        "accept" : "<code>", // Mime type to accept in the payload of the response, with charset etc.
        "contentType" : "<code>", // Mime type of the request payload contents, with charset etc.

        "destination" : <integer>, // Server responding to the request
        "encodeRequestUrl" : <boolean>, // R!  Whether or not to send the request url in encoded format
        "method" : "<code>", // delete | get | options | patch | post | put | head

        "origin" : <integer>, // Server initiating the request
        "params" : "<string>", // Explicitly defined path parameters
        "requestHeader" : [{ // Each operation can have one or more header elements
          "field" : "<string>", // R!  HTTP header field name
          "value" : "<string>" // R!  HTTP headerfield value
        }],
        "requestId" : "<id>", // Fixture Id of mapped request
        "responseId" : "<id>", // Fixture Id of mapped response
        "sourceId" : "<id>", // Fixture Id of body for PUT and POST requests
        "targetId" : "<id>", // Id of fixture used for extracting the [id],  [type], and [vid] for GET requests
        "url" : "<string>" // Request URL
      },
      "assert" : { // The assertion to perform
        "label" : "<string>", // Tracking/logging assertion label
        "description" : "<string>", // Tracking/reporting assertion description
        "direction" : "<code>", // response | request
        "compareToSourceId" : "<string>", // Id of the source fixture to be evaluated
        "compareToSourceExpression" : "<string>", // The FHIRPath expression to evaluate against the source fixture
        "compareToSourcePath" : "<string>", // XPath or JSONPath expression to evaluate against the source fixture
        "

        "contentType" : "<code>", // Mime type to compare against the 'Content-Type' header

        "expression" : "<string>", // The FHIRPath expression to be evaluated
        "headerField" : "<string>", // HTTP header field name
        "minimumId" : "<string>", // Fixture Id of minimum content resource
        "navigationLinks" : <boolean>, // Perform validation on navigation links?
        "operator" : "<code>", // equals | notEquals | in | notIn | greaterThan | lessThan | empty | notEmpty | contains | notContains | eval
        "path" : "<string>", // XPath or JSONPath expression
        "

        "requestMethod" : "<code>", // delete | get | options | patch | post | put | head

        "requestURL" : "<string>", // Request URL comparison value
        "resource" : "<code>", // Resource type
        "response" : "<code>", // okay | created | noContent | notModified | bad | forbidden | notFound | methodNotAllowed | conflict | gone | preconditionFailed | unprocessable
        "responseCode" : "<string>", // HTTP response code to test
        "
          "
          "
            "
            "
          }]
        },
        "
          "
          "
            "
            "
              "
              "
            }]
          }]
        },

        "sourceId" : "<id>", // Fixture Id of source expression or headerField
        "validateProfileId" : "<id>", // Profile Id of validation profile reference
        "value" : "<string>", // The value to compare to
        "warningOnly" : <boolean> // R!  Will this assert produce a warning only on error?
      }
    }]
  },
  "test" : [{ // A test in this script
    "name" : "<string>", // Tracking/logging name of this test
    "description" : "<string>", // Tracking/reporting short description of the test
    "action" : [{ // R!  A test operation or assert to perform
      "operation" : { Content as for TestScript.setup.action.operation }, // The setup operation to perform
      "assert" : { Content as for TestScript.setup.action.assert } // The setup assertion to perform
    }]
  }],
  "teardown" : { // A series of required clean up steps
    "action" : [{ // R!  One or more teardown operations to perform
      "operation" : { Content as for TestScript.setup.action.operation } // R!  The teardown operation to perform
    }]
  }
}

Turtle Template

@prefix fhir: <http://hl7.org/fhir/> .doco
[ a fhir:TestScript;
  fhir:nodeRole fhir:treeRoot; # if this is the parser root
  # from Resource: .id, .meta, .implicitRules, and .language
  # from DomainResource: .text, .contained, .extension, and .modifierExtension
  fhir:

  fhir:TestScript.url [ uri ]; # 1..1 Canonical identifier for this test script, represented as a URI (globally unique)

  fhir:TestScript.identifier [ Identifier ]; # 0..1 Additional identifier for the test script
  fhir:TestScript.version [ string ]; # 0..1 Business version of the test script
  fhir:TestScript.name [ string ]; # 1..1 Name for this test script (computer friendly)
  fhir:TestScript.title [ string ]; # 0..1 Name for this test script (human friendly)
  fhir:TestScript.status [ code ]; # 1..1 draft | active | retired | unknown
  fhir:

  fhir:TestScript.experimental [ boolean ]; # 0..1 For testing purposes, not real usage

  fhir:TestScript.date [ dateTime ]; # 0..1 Date last changed
  fhir:TestScript.publisher [ string ]; # 0..1 Name of the publisher (organization or individual)
  fhir:TestScript.contact [ ContactDetail ], ... ; # 0..* Contact details for the publisher
  fhir:TestScript.description [ markdown ]; # 0..1 Natural language description of the test script
  fhir:

  fhir:TestScript.useContext [ UsageContext ], ... ; # 0..* The context that the content is intended to support

  fhir:TestScript.jurisdiction [ CodeableConcept ], ... ; # 0..* Intended jurisdiction for test script (if applicable)
  fhir:TestScript.purpose [ markdown ]; # 0..1 Why this test script is defined
  fhir:TestScript.copyright [ markdown ]; # 0..1 Use and/or publishing restrictions
  fhir:TestScript.origin [ # 0..* An abstract server representing a client or sender in a message exchange
    fhir:TestScript.origin.index [ integer ]; # 1..1 The index of the abstract origin server starting at 1
    fhir:TestScript.origin.profile [ Coding ]; # 1..1 FHIR-Client | FHIR-SDC-FormFiller
  ], ...;
  fhir:TestScript.destination [ # 0..* An abstract server representing a destination or receiver in a message exchange
    fhir:TestScript.destination.index [ integer ]; # 1..1 The index of the abstract destination server starting at 1
    fhir:TestScript.destination.profile [ Coding ]; # 1..1 FHIR-Server | FHIR-SDC-FormManager | FHIR-SDC-FormReceiver | FHIR-SDC-FormProcessor
  ], ...;
  fhir:TestScript.metadata [ # 0..1 Required capability that is assumed to function correctly on the FHIR server being tested
    fhir:TestScript.metadata.link [ # 0..* Links to the FHIR specification
      fhir:TestScript.metadata.link.url [ uri ]; # 1..1 URL to the specification
      fhir:TestScript.metadata.link.description [ string ]; # 0..1 Short description
    ], ...;
    fhir:TestScript.metadata.capability [ # 1..* Capabilities  that are assumed to function correctly on the FHIR server being tested
      fhir:TestScript.metadata.capability.required [ boolean ]; # 1..1 Are the capabilities required?
      fhir:TestScript.metadata.capability.validated [ boolean ]; # 1..1 Are the capabilities validated?
      fhir:TestScript.metadata.capability.description [ string ]; # 0..1 The expected capabilities of the server
      fhir:TestScript.metadata.capability.origin [ integer ], ... ; # 0..* Which origin server these requirements apply to
      fhir:TestScript.metadata.capability.destination [ integer ]; # 0..1 Which server these requirements apply to
      fhir:TestScript.metadata.capability.link [ uri ], ... ; # 0..* Links to the FHIR specification
      fhir:TestScript.metadata.capability.capabilities [ canonical(CapabilityStatement) ]; # 1..1 Required Capability Statement
    ], ...;
  ];
  fhir:TestScript.fixture [ # 0..* Fixture in the test script - by reference (uri)
    fhir:TestScript.fixture.autocreate [ boolean ]; # 1..1 Whether or not to implicitly create the fixture during setup
    fhir:TestScript.fixture.autodelete [ boolean ]; # 1..1 Whether or not to implicitly delete the fixture during teardown
    fhir:TestScript.fixture.resource [ Reference(Any) ]; # 0..1 Reference of the resource
  ], ...;
  fhir:TestScript.profile [ Reference(Any) ], ... ; # 0..* Reference of the validation profile
  fhir:TestScript.variable [ # 0..* Placeholder for evaluated elements
    fhir:TestScript.variable.name [ string ]; # 1..1 Descriptive name for this variable
    fhir:TestScript.variable.defaultValue [ string ]; # 0..1 Default, hard-coded, or user-defined value for this variable
    fhir:TestScript.variable.description [ string ]; # 0..1 Natural language description of the variable
    fhir:TestScript.variable.expression [ string ]; # 0..1 The FHIRPath expression against the fixture body
    fhir:TestScript.variable.headerField [ string ]; # 0..1 HTTP header field name for source
    fhir:TestScript.variable.hint [ string ]; # 0..1 Hint help text for default value to enter
    fhir:TestScript.variable.path [ string ]; # 0..1 XPath or JSONPath against the fixture body
    fhir:TestScript.variable.sourceId [ id ]; # 0..1 Fixture Id of source expression or headerField within this variable
  ], ...;
  fhir:
    fhir:
    fhir:
      fhir:
      fhir:
    ], ...;
  ], ...;
  fhir:
    fhir:
    fhir:
      fhir:
      fhir:
        fhir:
        fhir:
      ], ...;
    ], ...;
  ], ...;

  fhir:TestScript.setup [ # 0..1 A series of required setup operations before tests are executed
    fhir:TestScript.setup.action [ # 1..* A setup operation or assert to perform
      fhir:TestScript.setup.action.operation [ # 0..1 The setup operation to perform
        fhir:TestScript.setup.action.operation.type [ Coding ]; # 0..1 The operation code type that will be executed
        fhir:TestScript.setup.action.operation.resource [ code ]; # 0..1 Resource type
        fhir:TestScript.setup.action.operation.label [ string ]; # 0..1 Tracking/logging operation label
        fhir:TestScript.setup.action.operation.description [ string ]; # 0..1 Tracking/reporting operation description
        fhir:TestScript.setup.action.operation.accept [ code ]; # 0..1 Mime type to accept in the payload of the response, with charset etc.
        fhir:TestScript.setup.action.operation.contentType [ code ]; # 0..1 Mime type of the request payload contents, with charset etc.
        fhir:TestScript.setup.action.operation.destination [ integer ]; # 0..1 Server responding to the request
        fhir:TestScript.setup.action.operation.encodeRequestUrl [ boolean ]; # 1..1 Whether or not to send the request url in encoded format
        fhir:TestScript.setup.action.operation.method [ code ]; # 0..1 delete | get | options | patch | post | put | head

        fhir:TestScript.setup.action.operation.origin [ integer ]; # 0..1 Server initiating the request
        fhir:TestScript.setup.action.operation.params [ string ]; # 0..1 Explicitly defined path parameters
        fhir:TestScript.setup.action.operation.requestHeader [ # 0..* Each operation can have one or more header elements
          fhir:TestScript.setup.action.operation.requestHeader.field [ string ]; # 1..1 HTTP header field name
          fhir:TestScript.setup.action.operation.requestHeader.value [ string ]; # 1..1 HTTP headerfield value
        ], ...;
        fhir:TestScript.setup.action.operation.requestId [ id ]; # 0..1 Fixture Id of mapped request
        fhir:TestScript.setup.action.operation.responseId [ id ]; # 0..1 Fixture Id of mapped response
        fhir:TestScript.setup.action.operation.sourceId [ id ]; # 0..1 Fixture Id of body for PUT and POST requests
        fhir:TestScript.setup.action.operation.targetId [ id ]; # 0..1 Id of fixture used for extracting the [id],  [type], and [vid] for GET requests
        fhir:TestScript.setup.action.operation.url [ string ]; # 0..1 Request URL
      ];
      fhir:TestScript.setup.action.assert [ # 0..1 The assertion to perform
        fhir:TestScript.setup.action.assert.label [ string ]; # 0..1 Tracking/logging assertion label
        fhir:TestScript.setup.action.assert.description [ string ]; # 0..1 Tracking/reporting assertion description
        fhir:TestScript.setup.action.assert.direction [ code ]; # 0..1 response | request
        fhir:TestScript.setup.action.assert.compareToSourceId [ string ]; # 0..1 Id of the source fixture to be evaluated
        fhir:TestScript.setup.action.assert.compareToSourceExpression [ string ]; # 0..1 The FHIRPath expression to evaluate against the source fixture
        fhir:TestScript.setup.action.assert.compareToSourcePath [ string ]; # 0..1 XPath or JSONPath expression to evaluate against the source fixture
        fhir:TestScript.setup.action.assert.contentType [ code ]; # 0..1 Mime type to compare against the 'Content-Type' header
        fhir:TestScript.setup.action.assert.expression [ string ]; # 0..1 The FHIRPath expression to be evaluated
        fhir:TestScript.setup.action.assert.headerField [ string ]; # 0..1 HTTP header field name
        fhir:TestScript.setup.action.assert.minimumId [ string ]; # 0..1 Fixture Id of minimum content resource
        fhir:TestScript.setup.action.assert.navigationLinks [ boolean ]; # 0..1 Perform validation on navigation links?
        fhir:TestScript.setup.action.assert.operator [ code ]; # 0..1 equals | notEquals | in | notIn | greaterThan | lessThan | empty | notEmpty | contains | notContains | eval
        fhir:TestScript.setup.action.assert.path [ string ]; # 0..1 XPath or JSONPath expression
        fhir:

        fhir:TestScript.setup.action.assert.requestMethod [ code ]; # 0..1 delete | get | options | patch | post | put | head

        fhir:TestScript.setup.action.assert.requestURL [ string ]; # 0..1 Request URL comparison value
        fhir:TestScript.setup.action.assert.resource [ code ]; # 0..1 Resource type
        fhir:TestScript.setup.action.assert.response [ code ]; # 0..1 okay | created | noContent | notModified | bad | forbidden | notFound | methodNotAllowed | conflict | gone | preconditionFailed | unprocessable
        fhir:TestScript.setup.action.assert.responseCode [ string ]; # 0..1 HTTP response code to test
        fhir:
          fhir:
          fhir:
            fhir:
            fhir:
          ], ...;
        ];
        fhir:
          fhir:
          fhir:
            fhir:
            fhir:
              fhir:
              fhir:
            ], ...;
          ], ...;
        ];

        fhir:TestScript.setup.action.assert.sourceId [ id ]; # 0..1 Fixture Id of source expression or headerField
        fhir:TestScript.setup.action.assert.validateProfileId [ id ]; # 0..1 Profile Id of validation profile reference
        fhir:TestScript.setup.action.assert.value [ string ]; # 0..1 The value to compare to
        fhir:TestScript.setup.action.assert.warningOnly [ boolean ]; # 1..1 Will this assert produce a warning only on error?
      ];
    ], ...;
  ];
  fhir:TestScript.test [ # 0..* A test in this script
    fhir:TestScript.test.name [ string ]; # 0..1 Tracking/logging name of this test
    fhir:TestScript.test.description [ string ]; # 0..1 Tracking/reporting short description of the test
    fhir:TestScript.test.action [ # 1..* A test operation or assert to perform
      fhir:TestScript.test.action.operation [ See TestScript.setup.action.operation ]; # 0..1 The setup operation to perform
      fhir:TestScript.test.action.assert [ See TestScript.setup.action.assert ]; # 0..1 The setup assertion to perform
    ], ...;
  ], ...;
  fhir:TestScript.teardown [ # 0..1 A series of required clean up steps
    fhir:TestScript.teardown.action [ # 1..* One or more teardown operations to perform
      fhir:TestScript.teardown.action.operation [ See TestScript.setup.action.operation ]; # 1..1 The teardown operation to perform
    ], ...;
  ];
]

Changes since DSTU2 Release 3

TestScript
TestScript.metadata.capability.required TestScript.status
  • Min Cardinality changed Change value set from 0 http://hl7.org/fhir/ValueSet/publication-status|4.0.0 to 1 Default Value "false" removed http://hl7.org/fhir/ValueSet/publication-status|4.1.0
TestScript.metadata.capability.validated TestScript.setup.action.operation.resource
  • Min Cardinality changed Change value set from 0 http://hl7.org/fhir/ValueSet/defined-types|4.0.0 to 1 Default Value "false" removed http://hl7.org/fhir/ValueSet/defined-types|4.1.0
TestScript.metadata.capability.capabilities TestScript.setup.action.operation.accept
  • Type changed Change value set from Reference(CapabilityStatement) http://hl7.org/fhir/ValueSet/mimetypes|4.0.0 to canonical http://hl7.org/fhir/ValueSet/mimetypes|4.1.0
TestScript.fixture.autocreate TestScript.setup.action.operation.contentType
  • Min Cardinality changed Change value set from 0 http://hl7.org/fhir/ValueSet/mimetypes|4.0.0 to 1 Default Value "false" removed http://hl7.org/fhir/ValueSet/mimetypes|4.1.0
TestScript.fixture.autodelete TestScript.setup.action.operation.method
  • Min Cardinality changed Change value set from 0 http://hl7.org/fhir/ValueSet/http-operations|4.0.0 to 1 Default Value "false" removed http://hl7.org/fhir/ValueSet/http-operations|4.1.0
TestScript.setup.action.operation.accept TestScript.setup.action.assert.direction
  • Change value set from http://hl7.org/fhir/ValueSet/content-type http://hl7.org/fhir/ValueSet/assert-direction-codes|4.0.0 to http://www.rfc-editor.org/bcp/bcp13.txt http://hl7.org/fhir/ValueSet/assert-direction-codes|4.1.0
TestScript.setup.action.operation.contentType TestScript.setup.action.assert.contentType
  • Change value set from http://hl7.org/fhir/ValueSet/content-type http://hl7.org/fhir/ValueSet/mimetypes|4.0.0 to http://www.rfc-editor.org/bcp/bcp13.txt http://hl7.org/fhir/ValueSet/mimetypes|4.1.0
TestScript.setup.action.operation.encodeRequestUrl TestScript.setup.action.assert.operator
  • Min Cardinality changed Change value set from 0 http://hl7.org/fhir/ValueSet/assert-operator-codes|4.0.0 to 1 Default Value "true" removed http://hl7.org/fhir/ValueSet/assert-operator-codes|4.1.0
TestScript.setup.action.assert.contentType TestScript.setup.action.assert.requestMethod
  • Change value set from http://hl7.org/fhir/ValueSet/content-type http://hl7.org/fhir/ValueSet/http-operations|4.0.0 to http://www.rfc-editor.org/bcp/bcp13.txt http://hl7.org/fhir/ValueSet/http-operations|4.1.0
TestScript.setup.action.assert.warningOnly TestScript.setup.action.assert.resource
  • Min Cardinality changed Change value set from 0 http://hl7.org/fhir/ValueSet/defined-types|4.0.0 to 1 http://hl7.org/fhir/ValueSet/defined-types|4.1.0
TestScript.setup.action.assert.response
  • Default Value "false" removed Change value set from http://hl7.org/fhir/ValueSet/assert-response-code-types|4.0.0 to http://hl7.org/fhir/ValueSet/assert-response-code-types|4.1.0

See the Full Difference for further information

This analysis is available as XML or JSON .

See R2 <--> R3 <--> R4 Conversion Maps (status = 6 7 tests that all execute ok. 6 1 fail round-trip testing and 6 7 r3 resources are invalid (11 (0 errors). ). Note: these have note yet been updated to be R3 to R4 )

 

Alternate See the Profiles & Extensions and the alternate definitions: Master Definition XML + JSON , XML Schema / Schematron + JSON Schema , ShEx (for Turtle ) + see the extensions , the spreadsheet version & the dependency analysis a

TestScript.setup.action.assert.requestMethod The allowable request method or HTTP operation codes. Required TestScriptRequestMethodCode
Path Definition Type Reference
TestScript.status The lifecycle status of an artifact. Required PublicationStatus
TestScript.jurisdiction Countries and regions within which this artifact is targeted for use use. Extensible Jurisdiction ValueSet
TestScript.origin.profile The type of origin profile the test system supports. Extensible TestScriptProfileOriginType
TestScript.destination.profile The type of destination profile the test system supports. Extensible TestScriptProfileDestinationType
TestScript.setup.action.operation.type The allowable operation code types. Extensible TestScriptOperationCode
TestScript.setup.action.operation.resource
TestScript.setup.action.assert.resource
A list of all the concrete types defined in this version of the FHIR specification - Data Types and Resource Types Types. Required Defined Types
TestScript.setup.action.operation.accept
TestScript.setup.action.operation.contentType
TestScript.setup.action.assert.contentType
The mime type of an attachment. Any valid mime type is allowed. Required BCP 13 (RFCs 2045, 2046, 2047, 4288, 4289 and 2049) Mime Types
TestScript.setup.action.operation.method
TestScript.setup.action.assert.requestMethod
The allowable request method or HTTP operation codes. Required TestScriptRequestMethodCode
TestScript.setup.action.assert.direction The type of direction to use for assertion. Required AssertionDirectionType
TestScript.setup.action.assert.operator The type of operator to use for assertion. Required AssertionOperatorType
TestScript.setup.action.assert.response The type of response code to use for assertion. Required AssertionResponseTypes

on TestScript.test.action.assert: compareToSourceId.empty() xor (compareToSourceExpression.exists() or compareToSourcePath.exists()) )
id Level Location Description Expression
inv-1 : On TestScript.setup.action: tst-0 Warning (base) Name should be usable as an identifier for the module by machine processing applications such as code generation name.matches('[A-Z]([A-Za-z0-9_]){0,254}')
tst-1 Rule TestScript.setup.action Setup action SHALL contain either an operation or assert but not both. ( expression on TestScript.setup.action: operation.exists() xor assert.exists() ) inv-10 : On TestScript.setup.action.assert: Setup action assert SHALL contain either compareToSourceId and compareToSourceExpression, compareToSourceId and compareToSourcePath or neither. ( expression on TestScript.setup.action.assert: compareToSourceId.empty() xor (compareToSourceExpression.exists() or compareToSourcePath.exists()) ) inv-11 : On TestScript.test.action.assert: Test action assert SHALL contain either compareToSourceId and compareToSourceExpression, compareToSourceId and compareToSourcePath or neither. ( expression
inv-12 : On TestScript.setup.action.assert: Setup action assert response and responseCode SHALL be empty when direction equals request ( expression on TestScript.setup.action.assert: (response.empty() and responseCode.empty() and direction = 'request') or direction.empty() or direction = 'response' ) tst-2 inv-13 : On TestScript.test.action.assert: Test action assert response and response and responseCode SHALL be empty when direction equals request ( expression Rule on TestScript.test.action.assert: (response.empty() and responseCode.empty() and direction = 'request') or direction.empty() or direction = 'response' ) inv-2 : On TestScript.test.action: TestScript.test.action Test action SHALL contain either an operation or assert but not both. ( expression on TestScript.test.action: operation.exists() xor assert.exists() )
inv-3 : On TestScript.variable: tst-3 Rule TestScript.variable Variable can only contain one of expression, headerField or path. ( expression on TestScript.variable: expression.empty() or headerField.empty() or path.empty() )
inv-4 : On TestScript.metadata: tst-4 Rule TestScript.metadata TestScript metadata capability SHALL contain required or validated or both. ( expression on TestScript.metadata: capability.required.exists() or capability.validated.exists() )
inv-5 : On TestScript.setup.action.assert: tst-5 Rule TestScript.setup.action.assert Only a single assertion SHALL be present within setup action assert element. ( expression on TestScript.setup.action.assert: contentType.count() extension.exists() or (contentType.count() + expression.count() + headerField.count() + minimumId.count() + navigationLinks.count() + path.count() + requestMethod.count() + resource.count() + responseCode.count() + response.count() + rule.count() + ruleset.count() + validateProfileId.count() <=1 <=1) )
inv-6 : On TestScript.test.action.assert: tst-6 Rule TestScript.test.action.assert Only a single assertion SHALL be present within test action assert element. ( expression on TestScript.test.action.assert: contentType.count() extension.exists() or (contentType.count() + expression.count() + headerField.count() + minimumId.count() + navigationLinks.count() + path.count() + requestMethod.count() + resource.count() + responseCode.count() + response.count() + rule.count() + ruleset.count() + validateProfileId.count() <=1 <=1) )
inv-7 : On TestScript.setup.action.operation: tst-7 Rule TestScript.setup.action.operation Setup operation SHALL contain either sourceId or targetId or params or url. ( expression on TestScript.setup.action.operation: sourceId.exists() or (targetId.count() + url.count() + params.count() = 1) or (type.code in ('capabilities' |'search' | 'transaction' | 'history')) )
inv-8 : On TestScript.test.action.operation: tst-8 Rule TestScript.test.action.operation Test operation SHALL contain either sourceId or targetId or params or url. ( expression on TestScript.test.action.operation: sourceId.exists() or (targetId.count() + url.count() + params.count() = 1) or (type.code in ('capabilities' | 'search' | 'transaction' | 'history')) )
inv-9 : On TestScript.teardown.action.operation: tst-9 Rule TestScript.teardown.action.operation Teardown operation SHALL contain either sourceId or targetId or params or url. ( expression on TestScript.teardown.action.operation: sourceId.exists() or (targetId.count() + url.count() + params.count() = 1) or (type.code in ('capabilities' | 'search' | 'transaction' | 'history')) )
tst-10 Rule TestScript.setup.action.assert Setup action assert SHALL contain either compareToSourceId and compareToSourceExpression, compareToSourceId and compareToSourcePath or neither. compareToSourceId.empty() xor (compareToSourceExpression.exists() or compareToSourcePath.exists())
tst-11 Rule TestScript.test.action.assert Test action assert SHALL contain either compareToSourceId and compareToSourceExpression, compareToSourceId and compareToSourcePath or neither. compareToSourceId.empty() xor (compareToSourceExpression.exists() or compareToSourcePath.exists())
tst-12 Rule TestScript.setup.action.assert Setup action assert response and responseCode SHALL be empty when direction equals request (response.empty() and responseCode.empty() and direction = 'request') or direction.empty() or direction = 'response'
tst-13 Rule TestScript.test.action.assert Test action assert response and response and responseCode SHALL be empty when direction equals request (response.empty() and responseCode.empty() and direction = 'request') or direction.empty() or direction = 'response'

Please refer to the Testing FHIR - How Tos for examples on working with this resource.

Search parameters for this resource. The common parameters also apply. See Searching for more information about searching in REST, messaging, and services.

Name Type Description Expression In Common
context token A use context assigned to the test script (TestScript.useContext.value as CodeableConcept)
context-quantity quantity A quantity- or range-valued use context assigned to the test script (TestScript.useContext.value as Quantity) | (TestScript.useContext.value as Range)
context-type token A type of use context assigned to the test script TestScript.useContext.code
context-type-quantity composite A use context type and quantity- or range-based value assigned to the test script On TestScript.useContext:
  context-type: code
  context-quantity: value.as(Quantity) | value.as(Range)
context-type-value composite A use context type and value assigned to the test script On TestScript.useContext:
  context-type: code
  context: value.as(CodeableConcept)
date date The test script publication date TestScript.date
description string The description of the test script TestScript.description
identifier token External identifier for the test script TestScript.identifier
jurisdiction token Intended jurisdiction for the test script TestScript.jurisdiction
name string Computationally friendly name of the test script TestScript.name
publisher string Name of the publisher of the test script TestScript.publisher
status token The current status of the test script TestScript.status
testscript-capability string TestScript required and validated capability TestScript.metadata.capability.description
title string The human-friendly name of the test script TestScript.title
url uri The uri that identifies the test script TestScript.url
version token The business version of the test script TestScript.version