FHIR Testing
0.1.0 - ci-build
FHIR Testing, published by NHO. This guide is not an authorized publication; it is the continuous build for version 0.1.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/costateixeira/fhirtesting and changes regularly. See the Directory of published versions
For authoring test cases for interoperability supporting FHIR, a dialect of Gherkin is used. This consists of a few key aspects
Systems supporting this specification should be able to parse this language and create executable test cases and provide reports.
{this is optional}
<this_is_parameter_or_variable>
Feature: ...
{Given
# Definitions
# e.g. ActorB = http://localhost:8080/fhir
}
WHEN
<Actor> issues a <method> request to {<Actor>}{/<path>}
<Actor> issues a <method> request to <endpoint>{/<type>}{/<id>}{$<operation>}{?&<parameters>}
AND content is
<file> / <inline JSON>
update({content,}attribute, value)
THEN
response.code == <a_code>
{response.content.}<jsonpathexpression> == {response.content.}jsonpathexpression
{response.content.}fhirpath(<expression>) == {response.content.}fhirpath(<expression>)
response.content.validate(<profile>)
* Def ServerUrl = localhost:8080/fhir” # Define a variable
WHEN system issues a POST request to FHIRServer # in this case, ‘system’ can be a reserved word to mean the test platform: this line will be executed by the test bed.
AND content is in “./file1.json”
THEN response.code == 200
* DEF patientId = response.content.id # simply JSONpath evaluation
* DEF IPSPatientCanonical = “https://hl7.org/fhir/uv/ips/StructureDefinition-Patient-uv-ips.html”
WHEN ActorA issues a GET request to FHIRServer/Patient/{patientId}
THEN response.code == 200
AND response.content.resourceType == “Patient”
AND response.content.validate(IPSPatientCanonical).error == 0 # custom function calling