{
"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": "example/TestScript-testscript-example-search.json",
"package_name": "hl7.fhir.uv.testing",
"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": {
"language": "text/fhirpath",
"expression": "Bundle.total.toInteger()"
},
"description": "Evaluate the returned Patient searchset Bundle.total value"
} ],
"publisher": "HL7 International / FHIR Infrastructure",
"purpose": "Patient Search Operation",
"resourceDefinition": "http://hl7.org/fhir/StructureDefinition/TestScript|0.1.0-snapshot1",
"name": "TestScriptExampleSearch",
"copyright": "© HL7.org 2011+",
"type": null,
"experimental": "false",
"resourceType": "TestScript",
"title": "TestScript Example Search",
"_profile": [ {
"id": "bundle-profile"
} ],
"setup": {
"action": [ {
"operation": {
"type": {
"code": "search",
"system": "http://hl7.org/fhir/restful-interaction"
},
"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,
"stopTestOnFail": false
}
}, {
"assert": {
"direction": "response",
"description": "Confirm that the returned HTTP status is 200(OK).",
"warningOnly": false,
"responseCode": "200",
"stopTestOnFail": false
}
}, {
"assert": {
"resource": "Bundle",
"description": "Confirm that the returned resource type is Bundle.",
"warningOnly": false,
"stopTestOnFail": false
}
}, {
"assert": {
"description": "Confirm that the returned Bundle correctly defines the navigation links.",
"warningOnly": false,
"stopTestOnFail": false,
"navigationLinks": true
}
} ]
},
"package_version": "0.1.0-snapshot1",
"status": "draft",
"id": "932360a3-a661-4c04-9efd-ce9c727defef",
"kind": null,
"url": "http://hl7.org/fhir/TestScript/testscript-example-search",
"identifier": [ {
"value": "urn:oid:2.16.840.1.113883.4.642.12.3",
"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"
} ]
} ],
"test": [ {
"id": "01-PatientCreateSearch",
"name": "Patient Create Search",
"action": [ {
"operation": {
"type": {
"code": "create",
"system": "http://hl7.org/fhir/restful-interaction"
},
"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,
"stopTestOnFail": false
}
}, {
"assert": {
"operator": "notEmpty",
"direction": "response",
"description": "Confirm that the returned HTTP Header Location is present.",
"headerField": "Location",
"warningOnly": false,
"stopTestOnFail": false
}
}, {
"operation": {
"url": "${PatientCreateLocation}",
"type": {
"code": "read",
"system": "http://hl7.org/fhir/restful-interaction"
},
"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,
"stopTestOnFail": false
}
}, {
"assert": {
"resource": "Patient",
"description": "Confirm that the returned resource type is Patient.",
"warningOnly": false,
"stopTestOnFail": 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://hl7.org/fhir/restful-interaction"
},
"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,
"stopTestOnFail": false
}
}, {
"assert": {
"contentType": "xml",
"description": "Confirm that the returned format is XML.",
"warningOnly": false,
"stopTestOnFail": false
}
}, {
"assert": {
"resource": "Bundle",
"description": "Confirm that the returned resource type is Bundle.",
"warningOnly": false,
"stopTestOnFail": true
}
}, {
"assert": {
"description": "Confirm that the returned Bundle conforms to the base FHIR specification.",
"warningOnly": false,
"stopTestOnFail": false,
"validateProfileId": "bundle-profile"
}
}, {
"assert": {
"value": "searchset",
"operator": "equals",
"expression": {
"language": "application/xml",
"expression": "fhir:Bundle/fhir:type/@value"
},
"description": "Confirm that the returned Bundle type equals 'searchset'.",
"warningOnly": false,
"stopTestOnFail": false
}
}, {
"assert": {
"expression": {
"language": "text/fhirpath",
"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,
"stopTestOnFail": false
}
} ],
"description": "Search for Patient resources using the user defined dynamic variables ${PatientSearchFamilyName} and ${PatientSearchGivenName} and validate response."
} ],
"profile": [ "http://hl7.org/fhir/StructureDefinition/Bundle" ]
}