Profile¶
The assertion below can be performed on request
and response
variables offered by the Touchstone Rules-Engine. This is similar to what the TestScript does via the validateProfileId assertion.
See the test script Patient-server-id-json for an example on how validateProfileId assertion is performed in TestScript and how the profile is defined:
ValidateProfile assertion definition in TestScript:
Profile definition in TestScript:
assertValidWithProfileId(validateProfileId)
Asserts that the response is valid according to the Profile specified by validateProfileId.
Example:
response.assertValidWithProfileId("bundle-profile")
Equivalent to these:
response.validateWithProfileId("bundle-profile")
assertValidWithProfileId("bundle-profile", response)
validateWithProfileId("bundle-profile", response)
assertValidWithProfile(validateProfileReference)
Rather than specifying a profile id that’s defined in the TestScript, we can validate using the profile URI directly. This call asserts that the request or response is valid according to the Profile URI specified by validateProfileReference.
Example:
response.assertValidWithProfile("http://hl7.org/fhir/StructureDefinition/Bundle")
Equivalent to these:
response.validateWithProfile("http://hl7.org/fhir/StructureDefinition/Bundle")
assertValidWithProfile("http://hl7.org/fhir/StructureDefinition/Bundle", response)
validateWithProfile("http://hl7.org/fhir/StructureDefinition/Bundle", response)
assertValidXmlExtractWithProfileId(xpath, validateProfileId)
Asserts that the XML content extracted from the request or response using the specified xpath expression is valid according to the Profile specified by validateProfileId. Please refer to XPath for more information on XPath expressions.
Example:
response.assertValidXmlExtractWithProfileId("Bundle/entry[1]/resource/Patient", "bundle-profile")
Equivalent to these:
response.extractXmlAndValidateWithProfileId("Bundle/entry[1]/resource/Patient", "bundle-profile")
assertValidXmlExtractWithProfileId("Bundle/entry[1]/resource/Patient", "bundle-profile", response)
extractXmlAndValidateWithProfileId("Bundle/entry[1]/resource/Patient", "bundle-profile", response)
assertValidXmlExtractWithProfile(xpath, validateProfileReference)
Asserts that the XML content extracted from the request or response using the specified xpath expression is valid according to the Profile URI specified by validateProfileReference. Please refer to XPath for more information on XPath expressions.
Example:
response.assertValidXmlExtractWithProfile("Bundle/entry[1]/resource/Patient", "http://hl7.org/fhir/StructureDefinition/Bundle")
Equivalent to these:
response.extractXmlAndValidateWithProfile("Bundle/entry[1]/resource/Patient", "http://hl7.org/fhir/StructureDefinition/Bundle")
assertValidXmlExtractWithProfile("Bundle/entry[1]/resource/Patient", "http://hl7.org/fhir/StructureDefinition/Bundle", response)
extractXmlAndValidateWithProfile("Bundle/entry[1]/resource/Patient", "http://hl7.org/fhir/StructureDefinition/Bundle", response)
assertValidJsonExtractWithProfileId(jsonpath, validateProfileId)
Asserts that the JSON content extracted from the request or response using the specified jsonpath expression is valid according to the Profile specified by validateProfileId. Please refer to JSONPath for more information on JSONPath expressions.
Example:
response.assertValidJsonExtractWithProfileId("context.orders[0]", "proc-request-profile")
Equivalent to these:
response.extractJsonAndValidateWithProfileId("context.orders[0]", "proc-request-profile")
assertValidJsonExtractWithProfileId("context.orders[0]", "proc-request-profile", response)
extractJsonAndValidateWithProfileId("context.orders[0]", "proc-request-profile", response)
assertValidJsonExtractWithProfile(jsonpath, validateProfileReference)
Asserts that the JSON content extracted from the request or response using the specified jsonpath expression is valid according to the Profile URI specified by validateProfileReference. Please refer to JSONPath for more information on JSONPath expressions.
Example:
response.assertValidJsonExtractWithProfile("context.orders[0]", "http://hl7.org/fhir/StructureDefinition/ProcedureRequest")
Equivalent to these:
response.extractJsonAndValidateWithProfile("context.orders[0]", "http://hl7.org/fhir/StructureDefinition/ProcedureRequest")
assertValidJsonExtractWithProfile("context.orders[0]", "http://hl7.org/fhir/StructureDefinition/ProcedureRequest", response)
extractJsonAndValidateWithProfile("context.orders[0]", "http://hl7.org/fhir/StructureDefinition/ProcedureRequest", response)