PackagesCanonicalsLogsProblems
    Packages
    hl7.fhir.core@3.5.0
    http://hl7.org/fhir/TestScript/testscript-example-search
{
  "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.",
  "_filename": "TestScript-testscript-example-search.json",
  "package_name": "hl7.fhir.core",
  "date": "2017-01-18",
  "variable": [ {
    "name": "PatientCreateLocation",
    "sourceId": "PatientCreateResponse",
    "headerField": "Location"
  }, {
    "hint": "[Family name]",
    "name": "PatientSearchFamilyName",
    "description": "Enter patient search criteria for a known family name on the target system"
  }, {
    "hint": "[Given name]",
    "name": "PatientSearchGivenName",
    "description": "Enter patient search criteria for a known given name on the target system"
  }, {
    "name": "PatientSearchBundleTotal",
    "expression": "Bundle.total.toInteger()",
    "description": "Evaluate the returned Patient searchset Bundle.total value"
  } ],
  "publisher": "HL7",
  "jurisdiction": [ {
    "coding": [ {
      "code": "US",
      "system": "urn:iso:std:iso:3166",
      "display": "United States of America (the)"
    } ]
  } ],
  "purpose": "Patient Search Operation",
  "name": "TestScript Example Search",
  "copyright": "© HL7.org 2011+",
  "type": null,
  "experimental": "true",
  "resourceType": "TestScript",
  "title": null,
  "setup": {
    "action": [ {
      "operation": {
        "type": {
          "code": "search",
          "system": "http://terminology.hl7.org/CodeSystem/testscript-operation-codes"
        },
        "accept": "xml",
        "params": "?family=DONTEXPECTAMATCH&given=DONTEXPECTAMATCH",
        "resource": "Patient",
        "description": "Test simple search to verify server support.",
        "encodeRequestUrl": true
      }
    }, {
      "assert": {
        "operator": "contains",
        "direction": "request",
        "requestURL": "family",
        "description": "Confirm that the request url contains the family search parameter.",
        "warningOnly": false
      }
    }, {
      "assert": {
        "direction": "response",
        "description": "Confirm that the returned HTTP status is 200(OK).",
        "warningOnly": false,
        "responseCode": "200"
      }
    }, {
      "assert": {
        "resource": "Bundle",
        "description": "Confirm that the returned resource type is Bundle.",
        "warningOnly": false
      }
    }, {
      "assert": {
        "description": "Confirm that the returned Bundle correctly defines the navigation links.",
        "warningOnly": false,
        "navigationLinks": true
      }
    } ]
  },
  "package_version": "3.5.0",
  "status": "draft",
  "id": "3a27b36c-cae8-4dcf-a23e-a941be8afb6a",
  "kind": null,
  "url": "http://hl7.org/fhir/TestScript/testscript-example-search",
  "identifier": {
    "value": "urn:oid:1.3.6.1.4.1.21367.2005.3.7.9881",
    "system": "urn:ietf:rfc:3986"
  },
  "fixture": [ {
    "id": "fixture-patient-create",
    "resource": {
      "display": "Peter Chalmers",
      "reference": "Patient/example"
    },
    "autocreate": false,
    "autodelete": false
  } ],
  "version": "1.0",
  "contact": [ {
    "name": "Support",
    "telecom": [ {
      "use": "work",
      "value": "support@HL7.org",
      "system": "email"
    } ]
  } ],
  "metadata": {
    "link": [ {
      "url": "http://hl7.org/fhir/patient.html",
      "description": "Demographics and other administrative information about an individual or animal receiving care or other health-related services."
    } ],
    "capability": [ {
      "link": [ "http://hl7.org/fhir/http.html#search" ],
      "required": true,
      "validated": false,
      "description": "Patient Search Operation",
      "capabilities": "CapabilityStatement/example"
    } ]
  },
  "test": [ {
    "id": "01-PatientCreateSearch",
    "name": "Patient Create Search",
    "action": [ {
      "operation": {
        "type": {
          "code": "create",
          "system": "http://terminology.hl7.org/CodeSystem/testscript-operation-codes"
        },
        "accept": "xml",
        "resource": "Patient",
        "sourceId": "fixture-patient-create",
        "responseId": "PatientCreateResponse",
        "contentType": "xml",
        "description": "Create a Patient resource and capture the returned HTTP Header Location.",
        "encodeRequestUrl": true
      }
    }, {
      "assert": {
        "response": "created",
        "description": "Confirm that the returned HTTP status is 201(Created).",
        "warningOnly": false
      }
    }, {
      "assert": {
        "operator": "notEmpty",
        "direction": "response",
        "description": "Confirm that the returned HTTP Header Location is present.",
        "headerField": "Location",
        "warningOnly": false
      }
    }, {
      "operation": {
        "url": "${PatientCreateLocation}",
        "type": {
          "code": "read",
          "system": "http://terminology.hl7.org/CodeSystem/testscript-operation-codes"
        },
        "accept": "xml",
        "description": "Read the created Patient using the captured Location URL value.",
        "encodeRequestUrl": true
      }
    }, {
      "assert": {
        "response": "okay",
        "description": "Confirm that the returned HTTP status is 200(OK).",
        "warningOnly": false
      }
    }, {
      "assert": {
        "resource": "Patient",
        "description": "Confirm that the returned resource type is Patient.",
        "warningOnly": false
      }
    } ],
    "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."
  }, {
    "id": "02-PatientSearchDynamic",
    "name": "Patient Search Dynamic",
    "action": [ {
      "operation": {
        "type": {
          "code": "search",
          "system": "http://terminology.hl7.org/CodeSystem/testscript-operation-codes"
        },
        "accept": "xml",
        "params": "?family=${PatientSearchFamilyName}&given=${PatientSearchGivenName}",
        "resource": "Patient",
        "description": "Search for Patient resources on the destination test system.",
        "encodeRequestUrl": true
      }
    }, {
      "assert": {
        "response": "okay",
        "description": "Confirm that the returned HTTP status is 200(OK).",
        "warningOnly": false
      }
    }, {
      "assert": {
        "contentType": "xml",
        "description": "Confirm that the returned format is XML.",
        "warningOnly": false
      }
    }, {
      "assert": {
        "resource": "Bundle",
        "description": "Confirm that the returned resource type is Bundle.",
        "warningOnly": false
      }
    }, {
      "assert": {
        "description": "Confirm that the returned Bundle conforms to the base FHIR specification.",
        "warningOnly": false,
        "validateProfileId": "bundle-profile"
      }
    }, {
      "assert": {
        "path": "fhir:Bundle/fhir:type/@value",
        "value": "searchset",
        "operator": "equals",
        "description": "Confirm that the returned Bundle type equals 'searchset'.",
        "warningOnly": false
      }
    }, {
      "assert": {
        "expression": "Bundle.total.toInteger() >= entry.count()",
        "description": "Confirm that the returned Bundle total is greater than or equal to the number of returned entries.",
        "warningOnly": false
      }
    } ],
    "description": "Search for Patient resources using the user defined dynamic variables ${PatientSearchFamilyName} and ${PatientSearchGivenName} and validate response."
  } ],
  "profile": [ {
    "id": "bundle-profile",
    "reference": "http://hl7.org/fhir/StructureDefinition/Bundle"
  } ]
}