FHIR © HL7.org  |  FHIRsmith 4.0.1  |  Server Home  |  XIG Home  |  XIG Stats  | 

FHIR IG analytics

Packagehl7.fhir.uv.testing
Resource TypeTestScript
IdTestScript-testscript-example-search.json
FHIR VersionR6

Resources that use this resource

No resources found


Resources that this resource uses

No resources found


Narrative

Note: links and images are rebased to the (stated) source

Generated Narrative: TestScript testscript-example-search

Language: en

url: http://hl7.org/fhir/TestScript/testscript-example-search

identifier: Uniform Resource Identifier (URI)/urn:oid:2.16.840.1.113883.4.642.12.3

version: 1.0

name: TestScriptExampleSearch

title: TestScript Example Search

status: Draft

experimental: false

date: 2017-01-18

publisher: HL7 International / FHIR Infrastructure

contact: Support: support@HL7.org

description:

TestScript example resource with simple Patient search test. The read tests will utilize user defined dynamic variables that will hold the Patient search parameter values.

purpose:

Patient Search Operation

copyright:

© HL7.org 2011+

fixture

id

fixture-patient-create

autocreate: false

autodelete: false

resource: Peter Chalmers

profile: Bundle

variable

name: PatientCreateLocation

headerField: Location

sourceId: PatientCreateResponse

variable

name: PatientSearchFamilyName

description: Enter patient search criteria for a known family name on the target system

hint: [Family name]

variable

name: PatientSearchGivenName

description: Enter patient search criteria for a known given name on the target system

hint: [Given name]

variable

name: PatientSearchBundleTotal

description: Evaluate the returned Patient searchset Bundle.total value

Expressions

-LanguageExpression
*text/fhirpathBundle.total.toInteger()

setup

action

Operations

-TypeResourceDescriptionAcceptEncodeRequestUrlParams
*FHIR Restful Interactions: search (search)http://hl7.org/fhir/StructureDefinition/PatientTest simple search to verify server support.xmltrue?family=DONTEXPECTAMATCH&given=DONTEXPECTAMATCH

action

Asserts

-DescriptionDirectionOperatorRequestURLStopTestOnFailWarningOnly
*Confirm that the request url contains the family search parameter.requestcontainsfamilyfalsefalse

action

Asserts

-DescriptionDirectionResponseCodeStopTestOnFailWarningOnly
*Confirm that the returned HTTP status is 200(OK).response200falsefalse

action

Asserts

-DescriptionResourceStopTestOnFailWarningOnly
*Confirm that the returned resource type is Bundle.http://hl7.org/fhir/StructureDefinition/Bundlefalsefalse

action

Asserts

-DescriptionNavigationLinksStopTestOnFailWarningOnly
*Confirm that the returned Bundle correctly defines the navigation links.truefalsefalse

test

id

01-PatientCreateSearch

name: Patient Create Search

description: Create a Patient resource and capture the returned HTTP Header Location. Then search for (read) that Patient using the Location URL value and validate the response.

action

Operations

-TypeResourceDescriptionAcceptContentTypeEncodeRequestUrlResponseIdSourceId
*FHIR Restful Interactions: create (create)http://hl7.org/fhir/StructureDefinition/PatientCreate a Patient resource and capture the returned HTTP Header Location.xmlxmltruePatientCreateResponsefixture-patient-create

action

Asserts

-DescriptionResponseStopTestOnFailWarningOnly
*Confirm that the returned HTTP status is 201(Created).Createdfalsefalse

action

Asserts

-DescriptionDirectionHeaderFieldOperatorStopTestOnFailWarningOnly
*Confirm that the returned HTTP Header Location is present.responseLocationnotEmptyfalsefalse

action

Operations

-TypeDescriptionAcceptEncodeRequestUrlUrl
*FHIR Restful Interactions: read (read)Read the created Patient using the captured Location URL value.xmltrue${PatientCreateLocation}

action

Asserts

-DescriptionResponseStopTestOnFailWarningOnly
*Confirm that the returned HTTP status is 200(OK).OKfalsefalse

action

Asserts

-DescriptionResourceStopTestOnFailWarningOnly
*Confirm that the returned resource type is Patient.http://hl7.org/fhir/StructureDefinition/Patientfalsefalse

test

id

02-PatientSearchDynamic

name: Patient Search Dynamic

description: Search for Patient resources using the user defined dynamic variables ${PatientSearchFamilyName} and ${PatientSearchGivenName} and validate response.

action

Operations

-TypeResourceDescriptionAcceptEncodeRequestUrlParams
*FHIR Restful Interactions: search (search)http://hl7.org/fhir/StructureDefinition/PatientSearch for Patient resources on the destination test system.xmltrue?family=${PatientSearchFamilyName}&given=${PatientSearchGivenName}

action

Asserts

-DescriptionResponseStopTestOnFailWarningOnly
*Confirm that the returned HTTP status is 200(OK).OKfalsefalse

action

Asserts

-DescriptionContentTypeStopTestOnFailWarningOnly
*Confirm that the returned format is XML.xmlfalsefalse

action

Asserts

-DescriptionResourceStopTestOnFailWarningOnly
*Confirm that the returned resource type is Bundle.http://hl7.org/fhir/StructureDefinition/Bundletruefalse

action

Asserts

-DescriptionStopTestOnFailValidateProfileIdWarningOnly
*Confirm that the returned Bundle conforms to the base FHIR specification.falsebundle-profilefalse

action

assert

description: Confirm that the returned Bundle type equals 'searchset'.

Expressions

-LanguageExpression
*application/xmlfhir:Bundle/fhir:type/@value

operator: equals

stopTestOnFail: false

value: searchset

warningOnly: false

action

assert

description: Confirm that the returned Bundle total is greater than or equal to the number of returned entries.

Expressions

-LanguageExpression
*text/fhirpathBundle.total.toInteger() >= entry.count()

stopTestOnFail: false

warningOnly: false


Source1

{
  "resourceType": "TestScript",
  "resourceDefinition": "http://hl7.org/fhir/StructureDefinition/TestScript|0.1.0-SNAPSHOT",
  "id": "testscript-example-search",
  "language": "en",
  "text": {
    "status": "generated",
    "div": "<!-- snip (see above) -->"
  },
  "url": "http://hl7.org/fhir/TestScript/testscript-example-search",
  "identifier": [
    {
      "system": "urn:ietf:rfc:3986",
      "value": "urn:oid:2.16.840.1.113883.4.642.12.3"
    }
  ],
  "version": "1.0",
  "name": "TestScriptExampleSearch",
  "title": "TestScript Example Search",
  "status": "draft",
  "experimental": false,
  "date": "2017-01-18",
  "publisher": "HL7 International / FHIR Infrastructure",
  "contact": [
    {
      "name": "Support",
      "telecom": [
        {
          "system": "email",
          "value": "support@HL7.org",
          "use": "work"
        }
      ]
    }
  ],
  "description": "TestScript example resource with simple Patient search test. The read tests will utilize user defined dynamic variables that will hold the Patient search parameter values.",
  "purpose": "Patient Search Operation",
  "copyright": "© HL7.org 2011+",
  "fixture": [
    {
      "id": "fixture-patient-create",
      "autocreate": false,
      "autodelete": false,
      "resource": {
        "reference": "Patient/example",
        "display": "Peter Chalmers"
      }
    }
  ],
  "profile": [
    "http://hl7.org/fhir/StructureDefinition/Bundle"
  ],
  "_profile": [
    {
      "id": "bundle-profile"
    }
  ],
  "variable": [
    {
      "name": "PatientCreateLocation",
      "headerField": "Location",
      "sourceId": "PatientCreateResponse"
    },
    {
      "name": "PatientSearchFamilyName",
      "description": "Enter patient search criteria for a known family name on the target system",
      "hint": "[Family name]"
    },
    {
      "name": "PatientSearchGivenName",
      "description": "Enter patient search criteria for a known given name on the target system",
      "hint": "[Given name]"
    },
    {
      "name": "PatientSearchBundleTotal",
      "description": "Evaluate the returned Patient searchset Bundle.total value",
      "expression": {
        "language": "text/fhirpath",
        "expression": "Bundle.total.toInteger()"
      }
    }
  ],
  "setup": {
    "action": [
      {
        "operation": {
          "type": {
            "system": "http://hl7.org/fhir/restful-interaction",
            "code": "search"
          },
          "resource": "Patient",
          "description": "Test simple search to verify server support.",
          "accept": "xml",
          "encodeRequestUrl": true,
          "params": "?family=DONTEXPECTAMATCH&given=DONTEXPECTAMATCH"
        }
      },
      {
        "assert": {
          "description": "Confirm that the request url contains the family search parameter.",
          "direction": "request",
          "operator": "contains",
          "requestURL": "family",
          "stopTestOnFail": false,
          "warningOnly": false
        }
      },
      {
        "assert": {
          "description": "Confirm that the returned HTTP status is 200(OK).",
          "direction": "response",
          "responseCode": "200",
          "stopTestOnFail": false,
          "warningOnly": false
        }
      },
      {
        "assert": {
          "description": "Confirm that the returned resource type is Bundle.",
          "resource": "Bundle",
          "stopTestOnFail": false,
          "warningOnly": false
        }
      },
      {
        "assert": {
          "description": "Confirm that the returned Bundle correctly defines the navigation links.",
          "navigationLinks": true,
          "stopTestOnFail": false,
          "warningOnly": false
        }
      }
    ]
  },
  "test": [
    {
      "id": "01-PatientCreateSearch",
      "name": "Patient Create Search",
      "description": "Create a Patient resource and capture the returned HTTP Header Location. Then search for (read) that Patient using the Location URL value and validate the response.",
      "action": [
        {
          "operation": {
            "type": {
              "system": "http://hl7.org/fhir/restful-interaction",
              "code": "create"
            },
            "resource": "Patient",
            "description": "Create a Patient resource and capture the returned HTTP Header Location.",
            "accept": "xml",
            "contentType": "xml",
            "encodeRequestUrl": true,
            "responseId": "PatientCreateResponse",
            "sourceId": "fixture-patient-create"
          }
        },
        {
          "assert": {
            "description": "Confirm that the returned HTTP status is 201(Created).",
            "response": "created",
            "stopTestOnFail": false,
            "warningOnly": false
          }
        },
        {
          "assert": {
            "description": "Confirm that the returned HTTP Header Location is present.",
            "direction": "response",
            "headerField": "Location",
            "operator": "notEmpty",
            "stopTestOnFail": false,
            "warningOnly": false
          }
        },
        {
          "operation": {
            "type": {
              "system": "http://hl7.org/fhir/restful-interaction",
              "code": "read"
            },
            "description": "Read the created Patient using the captured Location URL value.",
            "accept": "xml",
            "encodeRequestUrl": true,
            "url": "${PatientCreateLocation}"
          }
        },
        {
          "assert": {
            "description": "Confirm that the returned HTTP status is 200(OK).",
            "response": "okay",
            "stopTestOnFail": false,
            "warningOnly": false
          }
        },
        {
          "assert": {
            "description": "Confirm that the returned resource type is Patient.",
            "resource": "Patient",
            "stopTestOnFail": false,
            "warningOnly": false
          }
        }
      ]
    },
    {
      "id": "02-PatientSearchDynamic",
      "name": "Patient Search Dynamic",
      "description": "Search for Patient resources using the user defined dynamic variables ${PatientSearchFamilyName} and ${PatientSearchGivenName} and validate response.",
      "action": [
        {
          "operation": {
            "type": {
              "system": "http://hl7.org/fhir/restful-interaction",
              "code": "search"
            },
            "resource": "Patient",
            "description": "Search for Patient resources on the destination test system.",
            "accept": "xml",
            "encodeRequestUrl": true,
            "params": "?family=${PatientSearchFamilyName}&given=${PatientSearchGivenName}"
          }
        },
        {
          "assert": {
            "description": "Confirm that the returned HTTP status is 200(OK).",
            "response": "okay",
            "stopTestOnFail": false,
            "warningOnly": false
          }
        },
        {
          "assert": {
            "description": "Confirm that the returned format is XML.",
            "contentType": "xml",
            "stopTestOnFail": false,
            "warningOnly": false
          }
        },
        {
          "assert": {
            "description": "Confirm that the returned resource type is Bundle.",
            "resource": "Bundle",
            "stopTestOnFail": true,
            "warningOnly": false
          }
        },
        {
          "assert": {
            "description": "Confirm that the returned Bundle conforms to the base FHIR specification.",
            "stopTestOnFail": false,
            "validateProfileId": "bundle-profile",
            "warningOnly": false
          }
        },
        {
          "assert": {
            "description": "Confirm that the returned Bundle type equals 'searchset'.",
            "expression": {
              "language": "application/xml",
              "expression": "fhir:Bundle/fhir:type/@value"
            },
            "operator": "equals",
            "stopTestOnFail": false,
            "value": "searchset",
            "warningOnly": false
          }
        },
        {
          "assert": {
            "description": "Confirm that the returned Bundle total is greater than or equal to the number of returned entries.",
            "expression": {
              "language": "text/fhirpath",
              "expression": "Bundle.total.toInteger() >= entry.count()"
            },
            "stopTestOnFail": false,
            "warningOnly": false
          }
        }
      ]
    }
  ]
}