R6 Ballot (2nd Draft)

Publish-box (todo)

Example TestScript/testscript-example-readtest (Turtle)

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

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

Read 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-readtest"] ; # 
  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-readtest"^^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.2" ]
  ] ) ; # 
  fhir:version [ fhir:v "1.0"] ; # 
  fhir:name [ fhir:v "TestScript Example Read Test"] ; # 
  fhir:status [ fhir:v "draft"] ; # 
  fhir:experimental [ fhir:v "true"^^xsd:boolean] ; # 
  fhir:date [ fhir:v "2017-01-18"^^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 with ported Sprinkler basic read tests R001, R002, R003, R004. The read tests will utilize 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:metadata [
     fhir:link ( [
       fhir:url [ fhir:v "http://hl7.org/fhir/patient.html"^^xsd:anyURI ] ;
       fhir:description [ fhir:v "Demographics and other administrative information about an individual or animal receiving care or other health-related services." ]
     ] ) ;
     fhir:capability ( [
       fhir:required [ fhir:v "true"^^xsd:boolean ] ;
       fhir:validated [ fhir:v "false"^^xsd:boolean ] ;
       fhir:description [ fhir:v "Patient Read Operation" ] ;
       fhir:link ( [ fhir:v "http://hl7.org/fhir/http.html#read"^^xsd:anyURI ] ) ;
       fhir:capabilities [
         fhir:v "http://hl7.org/fhir/CapabilityStatement/example"^^xsd:anyURI ;
         fhir:link <http://hl7.org/fhir/CapabilityStatement/example>
       ]
     ] )
  ] ; # 
  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 "KnownPatientResourceId" ] ;
     fhir:defaultValue [ fhir:v "example" ]
  ] [
     fhir:name [ fhir:v "NonExistsPatientResourceId" ] ;
     fhir:defaultValue [ fhir:v "does-not-exist" ]
  ] ) ; # 
  fhir:test ( [
     fhir:id [ fhir:v "R001" ] ;
     fhir:name [ fhir:v "Sprinkler Read Test R001" ] ;
     fhir:description [ fhir:v "Read a known Patient and validate response." ] ;
     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 ${KnownPatientResourceId}." ] ;
         fhir:accept [ fhir:v "xml" ] ;
         fhir:encodeRequestUrl [ fhir:v "true"^^xsd:boolean ] ;
         fhir:params [ fhir:v "/${KnownPatientResourceId}" ]
       ]
     ] [
       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 ]
       ]
     ] )
  ] [
     fhir:id [ fhir:v "R002" ] ;
     fhir:name [ fhir:v "Sprinkler Read Test R002" ] ;
     fhir:description [ fhir:v "Read an unknown Resource Type and validate response." ] ;
     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 "Attempt to read the Parameters resource type. What we really want here is an illegal type but the build process won't allow that. Parameters is a valid resource which doesn't have an end-point so, this should fail." ] ;
         fhir:accept [ fhir:v "xml" ] ;
         fhir:encodeRequestUrl [ fhir:v "true"^^xsd:boolean ] ;
         fhir:params [ fhir:v "/1" ]
       ]
     ] [
       fhir:assert [
         fhir:description [ fhir:v "Confirm that the returned HTTP status is 404(Not Found)." ] ;
         fhir:response [ fhir:v "notFound" ] ;
         fhir:stopTestOnFail [ fhir:v "false"^^xsd:boolean ] ;
         fhir:warningOnly [ fhir:v "false"^^xsd:boolean ]
       ]
     ] )
  ] [
     fhir:id [ fhir:v "R003" ] ;
     fhir:name [ fhir:v "Sprinkler Read Test R003" ] ;
     fhir:description [ fhir:v "Read a known, non-existing Patient and validate response." ] ;
     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 "Attempt to read the non-existing Patient resource on the destination test system using the user defined dynamic variable ${NonExistsPatientResourceId}." ] ;
         fhir:accept [ fhir:v "xml" ] ;
         fhir:encodeRequestUrl [ fhir:v "true"^^xsd:boolean ] ;
         fhir:params [ fhir:v "/${NonExistsPatientResourceId}" ]
       ]
     ] [
       fhir:assert [
         fhir:description [ fhir:v "Confirm that the returned HTTP status is 404(Not Found)." ] ;
         fhir:response [ fhir:v "notFound" ] ;
         fhir:stopTestOnFail [ fhir:v "false"^^xsd:boolean ] ;
         fhir:warningOnly [ fhir:v "false"^^xsd:boolean ]
       ]
     ] )
  ] [
     fhir:id [ fhir:v "R004" ] ;
     fhir:name [ fhir:v "Sprinkler Read Test R004" ] ;
     fhir:description [ fhir:v "Read a Patient using a known bad formatted resource id and validate response." ] ;
     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 "Attempt to read a Patient resource on the destination test system using known bad formatted resource id." ] ;
         fhir:accept [ fhir:v "xml" ] ;
         fhir:encodeRequestUrl [ fhir:v "true"^^xsd:boolean ] ;
         fhir:params [ fhir:v "/ID-may-not-contain-CAPITALS" ]
       ]
     ] [
       fhir:assert [
         fhir:description [ fhir:v "Confirm that the returned HTTP status is 400(Bad Request)." ] ;
         fhir:response [ fhir:v "badRequest" ] ;
         fhir:stopTestOnFail [ fhir:v "false"^^xsd:boolean ] ;
         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.