This
page
is
part
of
the
Snapshot
#3
for
FHIR
Specification
(v4.0.1:
R4
-
Mixed
Normative
and
STU
)
in
it's
permanent
home
(it
will
always
be
available
at
this
URL).
The
current
version
which
supercedes
this
version
is
5.0.0
R5
,
released
to
support
Connectathon
32
.
For
a
full
list
of
available
versions,
see
the
Directory
of
published
versions
.
Page
versions:
R5
R4B
R4
R3
R2
| FHIR Infrastructure Work Group |
Maturity
Level
:
|
|
|
The
type
of
destination
profile
the
test
system
supports.
Cardinality
1..1
Terminology
Binding
Test
script
profile
destination
type
Raw
XML
(
Extensible
)
Type
Coding
Meaning
if
Missing
FHIR-Server
Comments
Must
be
a
"receiver"/"server"
profile.
TestScript.metadata
Element
Id
TestScript.metadata
Definition
The
required
capability
must
exist
and
are
assumed
to
function
correctly
on
the
FHIR
server
being
tested.
Cardinality
0..1
Invariants
Defined
on
this
element
tst-4
Rule
TestScript
metadata
capability
SHALL
contain
required
or
validated
or
both.
capability.required.exists()
or
capability.validated.exists()
TestScript.metadata.link
Element
Id
TestScript.metadata.link
Definition
A
link
to
the
FHIR
specification
that
this
test
is
covering.
Cardinality
0..*
TestScript.metadata.link.url
Element
Id
TestScript.metadata.link.url
Definition
URL
to
a
particular
requirement
or
feature
within
the
FHIR
specification.
Cardinality
1..1
Type
uri
TestScript.metadata.link.description
Element
Id
TestScript.metadata.link.description
Definition
Short
description
of
the
link.
Cardinality
0..1
Type
string
TestScript.metadata.capability
Element
Id
TestScript.metadata.capability
Definition
Capabilities
that
must
exist
and
are
assumed
to
function
correctly
on
the
FHIR
server
being
tested.
Cardinality
1..*
Comments
When
the
metadata
capabilities
section
is
defined
at
TestScript.metadata
or
at
TestScript.setup.metadata,
and
the
server's
conformance
statement
does
not
contain
the
elements
defined
in
the
minimal
conformance
statement,
then
all
the
tests
in
the
TestScript
are
skipped.
When
the
metadata
capabilities
section
is
defined
at
TestScript.test.metadata
and
the
server's
conformance
statement
does
not
contain
the
elements
defined
in
the
minimal
conformance
statement,
then
only
that
test
is
skipped.
The
"metadata.capabilities.required"
and
"metadata.capabilities.validated"
elements
only
indicate
whether
the
capabilities
are
the
primary
focus
of
the
test
script
or
not.
They
do
not
impact
the
skipping
logic.
Capabilities
whose
"metadata.capabilities.validated"
flag
is
true
are
the
primary
focus
of
the
test
script.
TestScript.metadata.capability.required
Element
Id
TestScript.metadata.capability.required
Definition
Whether
or
not
the
test
execution
will
require
the
given
capabilities
of
the
server
in
order
for
this
test
script
to
execute.
Cardinality
1..1
Type
boolean
TestScript.metadata.capability.validated
Element
Id
TestScript.metadata.capability.validated
Definition
Whether
or
not
the
test
execution
will
validate
the
given
capabilities
of
the
server
in
order
for
this
test
script
to
execute.
Cardinality
1..1
Type
boolean
TestScript.metadata.capability.description
Element
Id
TestScript.metadata.capability.description
Definition
Description
of
the
capabilities
that
this
test
script
is
requiring
the
server
to
support.
Cardinality
0..1
Type
string
TestScript.metadata.capability.origin
Element
Id
TestScript.metadata.capability.origin
Definition
Which
origin
server
these
requirements
apply
to.
Cardinality
0..*
Type
integer
TestScript.metadata.capability.destination
Element
Id
TestScript.metadata.capability.destination
Definition
Which
server
these
requirements
apply
to.
Cardinality
0..1
Type
integer
TestScript.metadata.capability.link
Element
Id
TestScript.metadata.capability.link
Definition
Links
to
the
FHIR
specification
that
describes
this
interaction
and
the
resources
involved
in
more
detail.
Cardinality
0..*
Type
uri
TestScript.metadata.capability.capabilities
Element
Id
TestScript.metadata.capability.capabilities
Definition
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.
Cardinality
1..1
Type
canonical
form
(
CapabilityStatement
)
Comments
The
conformance
statement
of
the
server
has
to
contain
at
a
minimum
the
contents
of
the
reference
pointed
to
by
this
element.
TestScript.fixture
Element
Id
TestScript.fixture
Definition
Fixture
in
the
test
script
-
by
reference
(uri).
All
fixtures
are
required
for
the
test
script
to
execute.
Cardinality
0..*
TestScript.fixture.autocreate
Element
Id
TestScript.fixture.autocreate
Definition
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.
Cardinality
1..1
Type
boolean
TestScript.fixture.autodelete
Element
Id
TestScript.fixture.autodelete
Definition
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.
Cardinality
1..1
Type
boolean
TestScript.fixture.resource
Element
Id
TestScript.fixture.resource
Definition
Reference
to
the
resource
(containing
the
contents
of
the
resource
needed
for
operations).
Cardinality
0..1
Type
Reference
(
Any
)
Comments
See
http://build.fhir.org/resourcelist.html
for
complete
list
of
resource
types.
TestScript.profile
Element
Id
TestScript.profile
Definition
Reference
to
the
profile
to
be
used
for
validation.
Cardinality
0..*
Type
Reference
(
Any
)
Comments
See
http://build.fhir.org/resourcelist.html
for
complete
list
of
resource
types.
TestScript.variable
Element
Id
TestScript.variable
Definition
Variable
is
set
based
either
on
element
value
in
response
body
or
on
header
field
value
in
the
response
headers.
Cardinality
0..*
Comments
Variables
would
be
set
based
either
on
XPath/JSONPath
expressions
against
fixtures
(static
and
response),
or
headerField
evaluations
against
response
headers.
If
variable
evaluates
to
nodelist
or
anything
other
than
a
primitive
value,
then
test
engine
would
report
an
error.
Variables
would
be
used
to
perform
clean
replacements
in
"operation.params",
"operation.requestHeader.value",
and
"operation.url"
element
values
during
operation
calls
and
in
"assert.value"
during
assertion
evaluations.
This
limits
the
places
that
test
engines
would
need
to
look
for
placeholders
"${}".
Variables
are
scoped
to
the
whole
script.
They
are
NOT
evaluated
at
declaration.
They
are
evaluated
by
test
engine
when
used
for
substitutions
in
"operation.params",
"operation.requestHeader.value",
and
"operation.url"
element
values
during
operation
calls
and
in
"assert.value"
during
assertion
evaluations.
See
example
testscript-search.xml.
Invariants
Defined
on
this
element
tst-3
Rule
Variable
can
only
contain
one
of
expression,
headerField
or
path.
expression.empty()
or
headerField.empty()
or
path.empty()
TestScript.variable.name
Element
Id
TestScript.variable.name
Definition
Descriptive
name
for
this
variable.
Cardinality
1..1
Type
string
Comments
Placeholders
would
contain
the
variable
name
wrapped
in
${}
in
"operation.params",
"operation.requestHeader.value",
and
"operation.url"
elements.
These
placeholders
would
need
to
be
replaced
by
the
variable
value
before
the
operation
is
executed.
TestScript.variable.defaultValue
Element
Id
TestScript.variable.defaultValue
Definition
A
default,
hard-coded,
or
user-defined
value
for
this
variable.
Cardinality
0..1
Type
string
Comments
The
purpose
of
this
element
is
to
allow
for
a
pre-defined
value
that
can
be
used
as
a
default
or
as
an
override
value.
Test
engines
can
optionally
use
this
as
a
placeholder
for
user-defined
execution
time
values.
TestScript.variable.description
Element
Id
TestScript.variable.description
Definition
A
free
text
natural
language
description
of
the
variable
and
its
purpose.
Cardinality
0..1
Type
string
TestScript.variable.expression
Element
Id
TestScript.variable.expression
Definition
The
FHIRPath
expression
to
evaluate
against
the
fixture
body.
When
variables
are
defined,
only
one
of
either
expression,
headerField
or
path
must
be
specified.
Cardinality
0..1
Type
string
Comments
If
headerField
is
defined,
then
the
variable
will
be
evaluated
against
the
headers
that
sourceId
is
pointing
to.
If
expression
or
path
is
defined,
then
the
variable
will
be
evaluated
against
the
fixture
body
that
sourceId
is
pointing
to.
It
is
an
error
to
define
any
combination
of
expression,
headerField
and
path.
TestScript.variable.headerField
Element
Id
TestScript.variable.headerField
Definition
Will
be
used
to
grab
the
HTTP
header
field
value
from
the
headers
that
sourceId
is
pointing
to.
Cardinality
0..1
Type
string
Comments
If
headerField
is
defined,
then
the
variable
will
be
evaluated
against
the
headers
that
sourceId
is
pointing
to.
If
path
is
defined,
then
the
variable
will
be
evaluated
against
the
fixture
body
that
sourceId
is
pointing
to.
It
is
an
error
to
define
both
headerField
and
path.
TestScript.variable.hint
Element
Id
TestScript.variable.hint
Definition
Displayable
text
string
with
hint
help
information
to
the
user
when
entering
a
default
value.
Cardinality
0..1
Type
string
TestScript.variable.path
Element
Id
TestScript.variable.path
Definition
XPath
or
JSONPath
to
evaluate
against
the
fixture
body.
When
variables
are
defined,
only
one
of
either
expression,
headerField
or
path
must
be
specified.
Cardinality
0..1
Type
string
Comments
If
headerField
is
defined,
then
the
variable
will
be
evaluated
against
the
headers
that
sourceId
is
pointing
to.
If
expression
or
path
is
defined,
then
the
variable
will
be
evaluated
against
the
fixture
body
that
sourceId
is
pointing
to.
It
is
an
error
to
define
any
combination
of
expression,
headerField
and
path.
TestScript.variable.sourceId
Element
Id
TestScript.variable.sourceId
Definition
Fixture
to
evaluate
the
XPath/JSONPath
expression
or
the
headerField
against
within
this
variable.
Cardinality
0..1
Type
id
Comments
This
can
be
a
statically
defined
fixture
(at
the
top
of
the
TestScript)
or
a
dynamically
set
fixture
created
by
responseId
of
the
action.operation
element.
TestScript.setup
Element
Id
TestScript.setup
Definition
A
series
of
required
setup
operations
before
tests
are
executed.
Cardinality
0..1
TestScript.setup.action
Element
Id
TestScript.setup.action
Definition
Action
would
contain
either
an
operation
or
an
assertion.
Cardinality
1..*
Comments
An
action
should
contain
either
an
operation
or
an
assertion
but
not
both.
It
can
contain
any
number
of
variables.
Invariants
Defined
on
this
element
tst-1
Rule
Setup
action
SHALL
contain
either
an
operation
or
assert
but
not
both.
operation.exists()
xor
assert.exists()
TestScript.setup.action.operation
Element
Id
TestScript.setup.action.operation
Definition
The
operation
to
perform.
Cardinality
0..1
Invariants
Defined
on
this
element
tst-7
Rule
Setup
operation
SHALL
contain
either
sourceId
or
targetId
or
params
or
url.
sourceId.exists()
or
(targetId.count()
+
url.count()
+
params.count()
=
1)
or
(type.code
in
('capabilities'
|'search'
|
'transaction'
|
'history'))
TestScript.setup.action.operation.type
Element
Id
TestScript.setup.action.operation.type
Definition
Server
interaction
or
operation
type.
Cardinality
0..1
Terminology
Binding
Test
script
operation
code
(
Extensible
)
Type
Coding
Comments
See
http://build.fhir.org/http.html
for
list
of
server
interactions.
TestScript.setup.action.operation.resource
Element
Id
TestScript.setup.action.operation.resource
Definition
The
type
of
the
resource.
See
http://build.fhir.org/resourcelist.html.
Cardinality
0..1
Terminology
Binding
Any
defined
Resource
or
Data
Type
name
Type
code
Comments
If
"url"
element
is
specified,
then
"targetId",
"params",
and
"resource"
elements
will
be
ignored
as
"url"
element
will
have
everything
needed
for
constructing
the
request
url.
If
"params"
element
is
specified,
then
"targetId"
element
is
ignored.
For
FHIR
operations
that
require
a
resource
(e.g.
"read"
and
"vread"
operations),
the
"resource"
element
must
be
specified
when
"params"
element
is
specified.
If
"url"
and
"params"
elements
are
absent,
then
the
request
url
will
be
constructed
from
"targetId"
fixture
if
present.
For
"read"
operation,
the
resource
and
id
values
will
be
extracted
from
"targetId"
fixture
and
used
to
construct
the
url.
For
"vread"
and
"history"
operations,
the
versionId
value
will
also
be
used.
TestScript.setup.action.operation.label
Element
Id
TestScript.setup.action.operation.label
Definition
The
label
would
be
used
for
tracking/logging
purposes
by
test
engines.
Cardinality
0..1
Type
string
Comments
This
has
no
impact
on
the
verification
itself.
TestScript.setup.action.operation.description
Element
Id
TestScript.setup.action.operation.description
Definition
The
description
would
be
used
by
test
engines
for
tracking
and
reporting
purposes.
Cardinality
0..1
Type
string
Comments
This
has
no
impact
on
the
verification
itself.
TestScript.setup.action.operation.accept
Element
Id
TestScript.setup.action.operation.accept
Definition
The
mime-type
to
use
for
RESTful
operation
in
the
'Accept'
header.
Cardinality
0..1
Terminology
Binding
MimeType
(
Required
)
Type
code
Comments
If
this
is
specified,
then
test
engine
shall
set
the
'Accept'
header
to
the
corresponding
value.
If
you'd
like
to
explicitly
set
the
'Accept'
to
some
other
value
then
use
the
'requestHeader'
element.
TestScript.setup.action.operation.contentType
Element
Id
TestScript.setup.action.operation.contentType
Definition
The
mime-type
to
use
for
RESTful
operation
in
the
'Content-Type'
header.
Cardinality
0..1
Terminology
Binding
MimeType
(
Required
)
Type
code
Comments
If
this
is
specified,
then
test
engine
shall
set
the
'Content-Type'
header
to
the
corresponding
value.
If
you'd
like
to
explicitly
set
the
'Content-Type'
to
some
other
value
then
use
the
'requestHeader'
element.
TestScript.setup.action.operation.destination
Element
Id
TestScript.setup.action.operation.destination
Definition
The
server
where
the
request
message
is
destined
for.
Must
be
one
of
the
server
numbers
listed
in
TestScript.destination
section.
Cardinality
0..1
Type
integer
Comments
If
multiple
TestScript.destination
elements
are
defined
and
operation.destination
is
undefined,
test
engine
will
report
an
error
as
it
cannot
determine
what
destination
to
use
for
the
exchange.
TestScript.setup.action.operation.encodeRequestUrl
Element
Id
TestScript.setup.action.operation.encodeRequestUrl
Definition
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.
Cardinality
1..1
Type
boolean
TestScript.setup.action.operation.method
Element
Id
TestScript.setup.action.operation.method
Definition
The
HTTP
method
the
test
engine
MUST
use
for
this
operation
regardless
of
any
other
operation
details.
Cardinality
0..1
Terminology
Binding
TestScriptRequestMethodCode
(
Required
see
XML
Format
Specification
)
Type
code
Comments
The
primary
purpose
of
the
explicit
HTTP
method
is
support
of
HTTP
POST
method
invocation
of
the
FHIR
search.
Other
uses
will
include
support
of
negative
testing.
TestScript.setup.action.operation.origin
Element
Id
TestScript.setup.action.operation.origin
Definition
The
server
where
the
request
message
originates
from.
Must
be
one
of
the
server
numbers
listed
in
TestScript.origin
section.
Cardinality
0..1
Type
integer
Comments
If
absent,
test
engine
will
send
the
message.
When
present,
test
engine
will
not
send
the
request
message
but
will
wait
for
the
request
message
to
be
sent
from
this
origin
server.
TestScript.setup.action.operation.params
Element
Id
TestScript.setup.action.operation.params
Definition
Path
plus
parameters
after
[type].
Used
to
set
parts
of
the
request
URL
explicitly.
Cardinality
0..1
Type
string
Comments
If
"url"
element
is
specified,
then
"targetId",
"params",
and
"resource"
elements
will
be
ignored
as
"url"
element
will
have
everything
needed
for
constructing
the
request
url.
If
"params"
element
is
specified,
then
"targetId"
element
is
ignored.
For
FHIR
operations
that
require
a
resource
(e.g.
"read"
and
"vread"
operations),
the
"resource"
element
must
be
specified
when
"params"
element
is
specified.
If
"url"
and
"params"
elements
are
absent,
then
the
request
url
will
be
constructed
from
"targetId"
fixture
if
present.
For
"read"
operation,
the
resource
and
id
values
will
be
extracted
from
"targetId"
fixture
and
used
to
construct
the
url.
For
"vread"
and
"history"
operations,
the
versionId
value
will
also
be
used.
Test
engines
would
append
whatever
is
specified
for
"params"
to
the
URL
after
the
resource
type
without
tampering
with
the
string
(beyond
encoding
the
URL
for
HTTP).
The
"params"
element
does
not
correspond
exactly
to
"search
parameters".
Nor
is
it
the
"path".
It
corresponds
to
the
part
of
the
URL
that
comes
after
the
[type]
(when
"resource"
element
is
specified);
e.g.
It
corresponds
to
"/[id]/_history/[vid]
{?_format=[mime-type]}"
in
the
following
operation:
GET
[base]/[type]/[id]/_history/[vid]
{?_format=[mime-type]}
Test
engines
do
have
to
look
for
placeholders
(${})
and
replace
the
variable
placeholders
with
the
variable
values
at
runtime
before
sending
the
request.
TestScript.setup.action.operation.requestHeader
Element
Id
TestScript.setup.action.operation.requestHeader
Definition
Header
elements
would
be
used
to
set
HTTP
headers.
Cardinality
0..*
Comments
This
gives
control
to
test-script
writers
to
set
headers
explicitly
based
on
test
requirements.
It
will
allow
for
testing
using:
-
"If-Modified-Since"
and
"If-None-Match"
headers.
See
http://build.fhir.org/http.html#2.1.0.5.1
-
"If-Match"
header.
See
http://build.fhir.org/http.html#2.1.0.11
-
Conditional
Create
using
"If-None-Exist".
See
http://build.fhir.org/http.html#2.1.0.13.1
-
Invalid
"Content-Type"
header
for
negative
testing.
-
etc.
TestScript.setup.action.operation.requestHeader.field
Element
Id
TestScript.setup.action.operation.requestHeader.field
Definition
The
HTTP
header
field
e.g.
"Accept".
Cardinality
1..1
Type
string
Comments
If
header
element
is
specified,
then
field
is
required.
TestScript.setup.action.operation.requestHeader.value
Element
Id
TestScript.setup.action.operation.requestHeader.value
Definition
The
value
of
the
header
e.g.
"application/fhir+xml".
Cardinality
1..1
Type
string
Comments
If
header
element
is
specified,
then
value
is
required.
No
conversions
will
be
done
by
the
test
engine
e.g.
"xml"
to
"application/fhir+xml".
The
values
will
be
set
in
HTTP
headers
"as-is".
Test
engines
do
have
to
look
for
placeholders
(${})
and
replace
the
variable
placeholders
with
the
variable
values
at
runtime
before
sending
the
request.
TestScript.setup.action.operation.requestId
Element
Id
TestScript.setup.action.operation.requestId
Definition
The
fixture
id
(maybe
new)
to
map
to
the
request.
Cardinality
0..1
Type
id
Comments
If
a
requestId
is
supplied,
then
the
resulting
request
(both
headers
and
body)
is
mapped
to
the
fixture
ID
(which
may
be
entirely
new
and
previously
undeclared)
designated
by
"requestId".
If
requestId
is
not
specified,
it
is
the
test
engine's
responsibility
to
store
the
request
and
use
it
as
the
requestId
in
subsequent
assertions
when
assertion
path
and/or
headerField
is
specified,
direction
is
equal
to
request,
and
the
requestId
in
not
specified.
TestScript.setup.action.operation.responseId
Element
Id
TestScript.setup.action.operation.responseId
Definition
The
fixture
id
(maybe
new)
to
map
to
the
response.
In
order
to
evaluate
an
assertion,
the
request,
response,
and
results
of
the
most
recently
executed
operation
must
always
be
maintained
by
the
test
engine.
AD-use
This
Usage
note:
every
effort
has
no
impact
on
the
verification
itself.
TestScript.setup.action.assert.direction
Element
Id
TestScript.setup.action.assert.direction
Definition
The
direction
to
use
for
the
assertion.
Cardinality
0..1
Terminology
Binding
AssertionDirectionType
(
Required
)
Type
code
Comments
If
the
direction
is
specified
as
"response"
(the
default),
then
the
processing
of
this
assert
is
against
the
received
response
message.
If
the
direction
is
specified
as
"request",
then
the
processing
of
this
assert
is
against
the
sent
request
message.
TestScript.setup.action.assert.compareToSourceId
Element
Id
TestScript.setup.action.assert.compareToSourceId
Definition
Id
of
the
source
fixture
used
as
the
contents
to
be
evaluated
by
either
the
"source/expression"
or
"sourceId/path"
definition.
Cardinality
0..1
Type
string
TestScript.setup.action.assert.compareToSourceExpression
Element
Id
TestScript.setup.action.assert.compareToSourceExpression
Definition
The
FHIRPath
expression
to
evaluate
against
the
source
fixture.
When
compareToSourceId
is
defined,
either
compareToSourceExpression
or
compareToSourcePath
must
be
defined,
but
not
both.
Cardinality
0..1
Type
string
Comments
Thefhirpath
expression
to
be
evaluated
against
the
expected
fixture
to
compare
to.
Ignored
if
"assert.value"
is
used.
The
evaluation
will
be
done
before
the
assertion
is
evaluated.
TestScript.setup.action.assert.compareToSourcePath
Element
Id
TestScript.setup.action.assert.compareToSourcePath
Definition
XPath
or
JSONPath
expression
to
evaluate
against
the
source
fixture.
When
compareToSourceId
is
defined,
either
compareToSourceExpression
or
compareToSourcePath
must
be
defined,
but
not
both.
Cardinality
0..1
Type
string
Comments
The
XPath
or
JSONPath
expression
to
be
evaluated
against
the
expected
fixture
to
compare
to.
Ignored
if
"assert.value"
is
used.
The
evaluation
will
be
done
before
the
assertion
is
evaluated.
TestScript.setup.action.assert.contentType
Element
Id
TestScript.setup.action.assert.contentType
Definition
The
mime-type
contents
to
compare
against
the
request
or
response
message
'Content-Type'
header.
Cardinality
0..1
Terminology
Binding
MimeType
(
Required
)
Type
code
Comments
If
this
is
specified,
then
test
engine
shall
confirm
that
the
content-type
of
the
last
operation's
headers
is
set
to
this
value.
If
"assert.sourceId"
element
is
specified,
then
the
evaluation
will
be
done
against
the
headers
mapped
to
that
sourceId
(and
not
the
last
operation's
headers).
If
you'd
like
to
have
more
control
over
the
string,
then
use
'assert.headerField'
instead.
TestScript.setup.action.assert.expression
Element
Id
TestScript.setup.action.assert.expression
Definition
The
FHIRPath
expression
to
be
evaluated
against
the
request
or
response
message
contents
-
HTTP
headers
and
payload.
Cardinality
0..1
Type
string
Comments
If
both
"expression"
and
a
"fixtureId"
are
specified,
then
the
expression
will
be
evaluated
against
the
request
or
response
body
mapped
to
the
fixtureId.
If
"expression"
is
specified
and
a
"fixtureId"
is
not,
then
the
expression
will
be
evaluated
against
the
response
body
of
the
last
operation.
Test
engines
are
to
store
the
request
and
response
body
and
headers
of
the
last
operation
at
all
times
for
subsequent
assertions.
TestScript.setup.action.assert.headerField
Element
Id
TestScript.setup.action.assert.headerField
Definition
The
HTTP
header
field
name
e.g.
'Location'.
Cardinality
0..1
Type
string
Comments
If
"headerField"
is
specified
then
"value"
must
be
specified.
If
"sourceId"
is
not
specified,
then
"headerField"
will
be
evaluated
against
the
last
operation's
response
headers.
Test
engines
are
to
keep
track
of
the
last
operation's
response
body
and
response
headers.
TestScript.setup.action.assert.minimumId
Element
Id
TestScript.setup.action.assert.minimumId
Definition
The
ID
of
a
fixture.
Asserts
that
the
response
contains
at
a
minimum
the
fixture
specified
by
minimumId.
Cardinality
0..1
Type
string
Comments
Asserts
that
the
response
contains
all
the
element/content
in
another
fixture
pointed
been
made
to
by
minimumId.
This
can
be
a
statically
defined
fixture
or
one
that
is
dynamically
set
via
responseId.
TestScript.setup.action.assert.navigationLinks
Element
Id
TestScript.setup.action.assert.navigationLinks
Definition
Whether
or
not
the
test
execution
performs
validation
on
the
bundle
navigation
links.
Cardinality
0..1
Type
boolean
Comments
Asserts
ensure
that
the
Bundle
contains
first,
last,
and
next
links.
TestScript.setup.action.assert.operator
Element
Id
TestScript.setup.action.assert.operator
Definition
The
operator
type
defines
the
conditional
behavior
of
the
assert.
If
not
defined,
the
default
is
equals.
Cardinality
0..1
Terminology
Binding
AssertionOperatorType
(
Required
)
Type
code
Comments
Operators
are
useful
especially
for
negative
testing.
If
operator
is
not
specified,
then
the
"equals"
operator
is
assumed;
e.g.
<code>
<assert>
<operator
value="in"
/>
<responseCode
value="200,201,204"
/>
</assert>
<assert>
<operator
value="notEquals"
/>
<response
value="okay"/>
</assert>
<assert>
<operator
value="greaterThan"
/>
<responseHeader>
<field
value="Content-Length"
/>
<value
value="0"
/>
</responseHeader/>
</assert>
</code>
.
TestScript.setup.action.assert.path
Element
Id
TestScript.setup.action.assert.path
Definition
The
XPath
or
JSONPath
expression
to
be
evaluated
against
the
fixture
representing
the
response
received
from
server.
Cardinality
0..1
Type
string
Comments
If
both
"path"
and
a
"fixtureId"
are
specified,
then
the
path
will
be
evaluated
against
the
request
or
response
body
mapped
to
the
fixtureId.
If
"path"
is
specified
and
a
"fixtureId"
is
not,
then
the
path
will
be
evaluated
against
the
response
body
of
the
last
operation.
Test
engines
examples
are
to
store
the
request
and
response
body
and
headers
of
the
last
operation
at
all
times
for
subsequent
assertions.
TestScript.setup.action.assert.requestMethod
Element
Id
TestScript.setup.action.assert.requestMethod
Definition
The
request
method
or
HTTP
operation
code
to
compare
against
that
used
by
the
client
system
under
test.
Cardinality
0..1
Terminology
Binding
TestScriptRequestMethodCode
(
Required
)
Type
code
Comments
If
"requestMethod"
is
specified
then
it
will
be
used
in
place
of
"value".
The
"requestMethod"
will
evaluate
against
the
last
operation's
request
HTTP
operation.
TestScript.setup.action.assert.requestURL
Element
Id
TestScript.setup.action.assert.requestURL
Definition
The
value
to
use
in
a
comparison
against
the
request
URL
path
string.
Cardinality
0..1
Type
string
Comments
If
"requestURL"
is
specified
then
it
will
be
used
in
place
of
"value".
The
"requestURL"
will
evaluate
against
the
last
operation's
full
request
URL
path
string.
TestScript.setup.action.assert.resource
Element
Id
TestScript.setup.action.assert.resource
Definition
The
type
of
the
resource.
See
http://build.fhir.org/resourcelist.html.
Cardinality
0..1
Terminology
Binding
Any
defined
Resource
or
Data
Type
name
Type
code
Comments
This
will
be
expected
resource
type
in
response
body
e.g.
in
read,
vread,
search,
etc.
See
http://build.fhir.org/resourcelist.html
for
complete
list
of
resource
types;
e.g.
<assert
>
<resourceType
value="Patient"
</assert>.
TestScript.setup.action.assert.response
Element
Id
TestScript.setup.action.assert.response
Definition
okay
|
created
|
noContent
|
notModified
|
bad
|
forbidden
|
notFound
|
methodNotAllowed
|
conflict
|
gone
|
preconditionFailed
|
unprocessable.
Cardinality
0..1
Terminology
Binding
AssertionResponseTypes
(
Required
)
Type
code
Comments
This
is
a
shorter
way
of
achieving
similar
verifications
via
"assert.responseCode".
If
you
need
more
control,
then
use
"assert.responseCode"
e.g.
<assert>
<contentType
value="json"
/>
<response
value="okay"/>
</assert>.
TestScript.setup.action.assert.responseCode
Element
Id
TestScript.setup.action.assert.responseCode
Definition
The
value
of
the
HTTP
response
code
to
be
tested.
Cardinality
0..1
Type
string
Comments
To
be
used
with
"operator"
attribute
value.
Asserts
that
the
response
code
equals
this
value
if
"operator"
is
not
specified.
If
the
operator
is
"in"
or
"notIn"
then
the
responseCode
would
be
a
comma-separated
list
of
values
e.g.
"200,201".
Otherwise,
it's
expected
to
be
a
numeric
value.
If
"fixture"
is
not
specified,
then
the
"responseBodyId"
value
of
the
last
operation
is
assumed.
TestScript.setup.action.assert.sourceId
Element
Id
TestScript.setup.action.assert.sourceId
Definition
Fixture
to
evaluate
the
XPath/JSONPath
expression
or
the
headerField
against.
Cardinality
0..1
Type
id
Comments
This
can
be
a
statically
defined
fixture
(at
the
top
of
the
testscript)
or
a
dynamically
set
fixture
created
by
responseId
of
the
action.operation
element.
TestScript.setup.action.assert.validateProfileId
Element
Id
TestScript.setup.action.assert.validateProfileId
Definition
The
ID
of
the
Profile
to
validate
against.
Cardinality
0..1
Type
id
Comments
The
ID
of
a
Profile
fixture.
Asserts
that
the
response
is
valid
according
to
the
Profile
specified
by
validateProfileId.
TestScript.setup.action.assert.value
Element
Id
TestScript.setup.action.assert.value
Definition
The
value
to
compare
to.
Cardinality
0..1
Type
string
Comments
The
string-representation
of
a
number,
string,
or
boolean
that
is
expected.
Test
engines
do
have
to
look
for
placeholders
(${})
and
replace
the
variable
placeholders
with
the
variable
values
at
runtime
before
comparing
this
value
to
the
actual
value.
TestScript.setup.action.assert.warningOnly
Element
Id
TestScript.setup.action.assert.warningOnly
Definition
Whether
or
not
the
test
execution
will
produce
a
warning
only
on
error
for
this
assert.
Cardinality
1..1
Type
boolean
Comments
If
this
element
is
specified
correct
and
it
is
true,
then
assertion
failures
can
be
logged
by
test
engine
useful,
but
should
not
stop
the
test
script
execution
from
proceeding.
There
they
are
likely
cases
where
the
spec
is
not
clear
on
what
should
happen.
If
the
spec
says
something
is
optional
(maybe
a
response
header
for
example),
but
a
server
doesn’t
do
it,
we
could
choose
to
issue
a
warning.
TestScript.test
Element
Id
TestScript.test
Definition
A
test
in
this
script.
Cardinality
0..*
TestScript.test.name
Element
Id
TestScript.test.name
Definition
The
name
of
this
test
used
for
tracking/logging
purposes
by
test
engines.
Cardinality
0..1
Type
string
TestScript.test.description
Element
Id
TestScript.test.description
Definition
A
short
description
of
the
test
used
by
test
engines
for
tracking
and
reporting
purposes.
Cardinality
0..1
Type
string
TestScript.test.action
Element
Id
TestScript.test.action
Definition
Action
would
contain
either
an
operation
or
an
assertion.
Cardinality
1..*
Comments
An
action
should
contain
either
an
operation
or
an
assertion
but
not
both.
It
can
contain
any
number
of
variables.
Invariants
Defined
on
this
element
tst-2
Rule
Test
action
SHALL
contain
either
an
operation
or
assert
but
not
both.
operation.exists()
xor
assert.exists()
TestScript.test.action.operation
Element
Id
TestScript.test.action.operation
Definition
An
operation
would
involve
a
REST
request
to
a
server.
Cardinality
0..1
Type
See
TestScript.setup.action.operation
Invariants
Defined
on
this
element
tst-8
Rule
Test
operation
SHALL
contain
either
sourceId
or
targetId
or
params
or
url.
sourceId.exists()
or
(targetId.count()
+
url.count()
+
params.count()
=
1)
or
(type.code
in
('capabilities'
|
'search'
|
'transaction'
|
'history'))
TestScript.test.action.assert
Element
Id
TestScript.test.action.assert
Definition
Evaluates
the
results
of
previous
operations
to
determine
if
the
server
under
test
behaves
appropriately.
Cardinality
0..1
Type
See
TestScript.setup.action.assert
Comments
In
order
to
evaluate
an
assertion,
the
request,
response,
and
results
of
the
most
recently
executed
operation
must
always
be
maintained
by
the
test
engine.
Invariants
Defined
on
this
element
tst-6
Rule
Only
a
single
assertion
SHALL
be
present
within
test
action
assert
element.
extension.exists()
or
(contentType.count()
+
expression.count()
+
headerField.count()
+
minimumId.count()
+
navigationLinks.count()
+
path.count()
+
requestMethod.count()
+
resource.count()
+
responseCode.count()
+
response.count()
+
validateProfileId.count()
<=1)
tst-11
Rule
Test
action
assert
SHALL
contain
either
compareToSourceId
and
compareToSourceExpression,
compareToSourceId
and
compareToSourcePath
or
neither.
compareToSourceId.empty()
xor
(compareToSourceExpression.exists()
or
compareToSourcePath.exists())
tst-13
Rule
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'
TestScript.teardown
Element
Id
TestScript.teardown
Definition
A
series
normative
part
of
operations
required
to
clean
up
after
all
the
tests
are
executed
(successfully
or
otherwise).
Cardinality
0..1
TestScript.teardown.action
Element
Id
TestScript.teardown.action
Definition
The
teardown
action
will
only
contain
an
operation.
Cardinality
1..*
Comments
An
action
should
contain
either
an
operation
or
an
assertion
but
not
both.
It
can
contain
any
number
of
variables.
TestScript.teardown.action.operation
Element
Id
TestScript.teardown.action.operation
Definition
An
operation
would
involve
a
REST
request
to
a
server.
specification.