R6 Ballot (2nd Draft)

Publish-box (todo)

Example TestScript/testscript-example-readcommon (Turtle)

FHIR Infrastructure Work GroupMaturity Level: N/AStandards Status: InformativeCompartments: No defined compartments

Raw Turtle (+ also see Turtle/RDF Format Specification)

Read Common TestScript Example

@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

# - resource -------------------------------------------------------------------

[a fhir:TestScript ;
  fhir:nodeRole fhir:treeRoot ;
  fhir:id [ fhir:v "testscript-example-readcommon"] ; # 
  fhir:extension ( [
     fhir:url [ fhir:v "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg"^^xsd:anyURI ] ;
     fhir:value [ fhir:v "fhir" ]
  ] ) ; # 
  fhir:url [ fhir:v "http://hl7.org/fhir/TestScript/testscript-example-readcommon"^^xsd:anyURI] ; # 
  fhir:identifier ( [
     fhir:system [ fhir:v "urn:ietf:rfc:3986"^^xsd:anyURI ] ;
     fhir:value [ fhir:v "urn:oid:2.16.840.1.113883.4.642.12.8" ]
  ] ) ; # 
  fhir:version [ fhir:v "1.0"] ; # 
  fhir:name [ fhir:v "TestScript Example Read Common"] ; # 
  fhir:status [ fhir:v "draft"] ; # 
  fhir:experimental [ fhir:v "true"^^xsd:boolean] ; # 
  fhir:date [ fhir:v "2024-04-24"^^xsd:date] ; # 
  fhir:publisher [ fhir:v "HL7 International / FHIR Infrastructure"] ; # 
  fhir:contact ( [
     fhir:telecom ( [
       fhir:system [ fhir:v "url" ] ;
       fhir:value [ fhir:v "http://www.hl7.org/Special/committees/fiwg" ]
     ] )
  ] ) ; # 
  fhir:description [ fhir:v "TestScript example resource showing the use of the common element to reuse actions within the test element. Each test will perform a Patient read operation utilizing user defined dynamic variables that will hold the Patient resource id values."] ; # 
  fhir:jurisdiction ( [
     fhir:coding ( [
       fhir:system [ fhir:v "urn:iso:std:iso:3166"^^xsd:anyURI ] ;
       fhir:code [ fhir:v "US" ] ;
       fhir:display [ fhir:v "United States of America" ]
     ] )
  ] ) ; # 
  fhir:purpose [ fhir:v "Patient Read Operation"] ; # 
  fhir:copyright [ fhir:v "© HL7.org 2011+"] ; # 
  fhir:scope ( [
     fhir:artifact [
       fhir:v "http://hl7.org/fhir/StructureDefinition/Patient"^^xsd:anyURI ;
       fhir:link <http://hl7.org/fhir/StructureDefinition/Patient>
     ] ;
     fhir:conformance [
       fhir:coding ( [
         fhir:system [ fhir:v "http://hl7.org/fhir/testscript-scope-conformance-codes"^^xsd:anyURI ] ;
         fhir:code [ fhir:v "optional" ]
       ] )
     ] ;
     fhir:phase [
       fhir:coding ( [
         fhir:system [ fhir:v "http://hl7.org/fhir/testscript-scope-phase-codes"^^xsd:anyURI ] ;
         fhir:code [ fhir:v "unit" ]
       ] )
     ]
  ] ) ; # 
  fhir:profile ( [
     fhir:v "http://hl7.org/fhir/StructureDefinition/Patient"^^xsd:anyURI ;
     fhir:link <http://hl7.org/fhir/StructureDefinition/Patient>
  ] ) ; # 
  fhir:variable ( [
     fhir:name [ fhir:v "PatientResourceId1" ] ;
     fhir:defaultValue [ fhir:v "f001" ]
  ] [
     fhir:name [ fhir:v "PatientResourceId2" ] ;
     fhir:defaultValue [ fhir:v "f002" ]
  ] ) ; # 
  fhir:test ( [
     fhir:id [ fhir:v "PatientRead1" ] ;
     fhir:name [ fhir:v "Patient Read Test 1" ] ;
     fhir:description [ fhir:v "Read a known Patient (default id 'f001') and validate response using common action asserts." ] ;
     fhir:action ( [
       fhir:operation [
         fhir:type [
           fhir:system [ fhir:v "http://hl7.org/fhir/restful-interaction"^^xsd:anyURI ] ;
           fhir:code [ fhir:v "read" ]
         ] ;
         fhir:resource [ fhir:v "Patient"^^xsd:anyURI ] ;
         fhir:description [ fhir:v "Read the known Patient resource on the destination test system using the user defined dynamic variable ${PatientResourceId1}." ] ;
         fhir:accept [ fhir:v "xml" ] ;
         fhir:encodeRequestUrl [ fhir:v "true"^^xsd:boolean ] ;
         fhir:params [ fhir:v "/${PatientResourceId1}" ]
       ]
     ] [
       fhir:common [
         fhir:keyRef [ fhir:v "CommonReadActionAsserts" ]
       ]
     ] )
  ] [
     fhir:id [ fhir:v "PatientRead2" ] ;
     fhir:name [ fhir:v "Patient Read Test 2" ] ;
     fhir:description [ fhir:v "Read a known Patient (default id 'f002') and validate response using common action asserts." ] ;
     fhir:action ( [
       fhir:operation [
         fhir:type [
           fhir:system [ fhir:v "http://hl7.org/fhir/restful-interaction"^^xsd:anyURI ] ;
           fhir:code [ fhir:v "read" ]
         ] ;
         fhir:resource [ fhir:v "Patient"^^xsd:anyURI ] ;
         fhir:description [ fhir:v "Read the known Patient resource on the destination test system using the user defined dynamic variable ${PatientResourceId2}." ] ;
         fhir:accept [ fhir:v "xml" ] ;
         fhir:encodeRequestUrl [ fhir:v "true"^^xsd:boolean ] ;
         fhir:params [ fhir:v "/${PatientResourceId2}" ]
       ]
     ] [
       fhir:common [
         fhir:keyRef [ fhir:v "CommonReadActionAsserts" ]
       ]
     ] )
  ] ) ; # 
  fhir:common ( [
     fhir:key [ fhir:v "CommonReadActionAsserts" ] ;
     fhir:name [ fhir:v "Common Read Action Asserts" ] ;
     fhir:description [ fhir:v "The common action asserts to evaluate and validate conformance to the base FHIR read operation." ] ;
     fhir:action ( [
       fhir:assert [
         fhir:description [ fhir:v "Confirm that the returned HTTP status is 200(OK)." ] ;
         fhir:response [ fhir:v "okay" ] ;
         fhir:stopTestOnFail [ fhir:v "false"^^xsd:boolean ] ;
         fhir:warningOnly [ fhir:v "false"^^xsd:boolean ]
       ]
     ] [
       fhir:assert [
         fhir:description [ fhir:v "Confirm that the returned format is XML." ] ;
         fhir:contentType [ fhir:v "xml" ] ;
         fhir:stopTestOnFail [ fhir:v "false"^^xsd:boolean ] ;
         fhir:warningOnly [ fhir:v "false"^^xsd:boolean ]
       ]
     ] [
       fhir:assert [
         fhir:description [ fhir:v "Confirm that the returned HTTP Header Last-Modified is present. Warning only as the server might not support versioning." ] ;
         fhir:headerField [ fhir:v "Last-Modified" ] ;
         fhir:operator [ fhir:v "notEmpty" ] ;
         fhir:stopTestOnFail [ fhir:v "false"^^xsd:boolean ] ;
         fhir:warningOnly [ fhir:v "true"^^xsd:boolean ]
       ]
     ] [
       fhir:assert [
         fhir:description [ fhir:v "Confirm that the returned resource type is Patient." ] ;
         fhir:resource [ fhir:v "Patient"^^xsd:anyURI ] ;
         fhir:stopTestOnFail [ fhir:v "false"^^xsd:boolean ] ;
         fhir:warningOnly [ fhir:v "false"^^xsd:boolean ]
       ]
     ] [
       fhir:assert [
         fhir:description [ fhir:v "Confirm that the returned Patient conforms to the base FHIR specification." ] ;
         fhir:stopTestOnFail [ fhir:v "false"^^xsd:boolean ] ;
         fhir:validateProfileId [ fhir:v "patient-profile" ] ;
         fhir:warningOnly [ fhir:v "false"^^xsd:boolean ]
       ]
     ] )
  ] )] . # 

# -------------------------------------------------------------------------------------


Usage note: every effort has been made to ensure that the examples are correct and useful, but they are not a normative part of the specification.