Request URL

The following assertions can be performed on request variable offered by the Touchstone Rules-Engine.

They would validate the request URL. These assertions would make sense in Peer-to-Peer testing.

  • assertRequestURLEquals(expectedValue)

    • Asserts that the URL of the request matches the provided expectedValue

    • Example:

      request.assertRequestURLEquals("http://touchstone.aegis.net:57084/fhir3-0-1/Patient?name=Connectathon15")
      
    • Equivalent to these:

      assertRequestURLEquals("http://touchstone.aegis.net:57084/fhir3-0-1/Patient?name=Connectathon15", request)
      
      // expected URL and operator can be passed as parameters from test script.
      assertRequestURL("http://touchstone.aegis.net:57084/fhir3-0-1/Patient?name=Connectathon15",
            "equals", request)
      
      assert request.getURL()=="http://touchstone.aegis.net:57084/fhir3-0-1/Patient?name=Connectathon15": "The
         actual value \""+request.getURL()+"\" did not match the expected value
            \"http://touchstone.aegis.net:57084/fhir3-0-1/Patient?name=Connectathon15\" for URL in request"
      
      assert equals("http://touchstone.aegis.net:57084/fhir3-0-1/Patient?name=Connectathon15",
         request.getURL()): "The actual value \""+request.getURL()+"\" did not match the expected value
            \"http://touchstone.aegis.net:57084/fhir3-0-1/Patient?name=Connectathon15\" for URL in request"
      
  • assertRequestURLNotEquals(expectedValue)

    • Asserts that the URL of the request does not match the provided expectedValue

    • Example:

      request.assertRequestURLNotEquals(
                  "http://touchstone.aegis.net:57084/fhir3-0-1/Patient?name=Connectathon15")
      
    • Equivalent to these:

      assertRequestURLNotEquals("http://touchstone.aegis.net:57084/fhir3-0-1/Patient?name=Connectathon15",
         request)
      
      // expected URL and operator can be passed as parameters from test script.
      assertRequestURL("http://touchstone.aegis.net:57084/fhir3-0-1/Patient?name=Connectathon15",
                        "notEquals", request)
      
      assert request.getURL()=="http://touchstone.aegis.net:57084/fhir3-0-1/Patient?name=Connectathon15":
         "The actual value \""+request.getURL()+"\" matched the expected value
         \"http://touchstone.aegis.net:57084/fhir3-0-1/Patient?name=Connectathon15\" for URL with
            operator 'notEquals' in request"
      
      assert notEquals("http://touchstone.aegis.net:57084/fhir3-0-1/Patient?name=Connectathon15",
         request.getURL()): "The actual value \""+request.getURL()+"\" matched the expected value
            \"http://touchstone.aegis.net:57084/fhir3-0-1/Patient?name=Connectathon15\" for URL with
               operator 'notEquals' in request"
      
  • assertRequestURLContains(expectedValue)

    • Asserts that the URL of the request contains the provided expectedValue

    • Example:

      request.assertRequestURLContains("fhir3-0-1/Patient?name=Connectathon15")
      
    • Equivalent to these:

      assertRequestURLContains("fhir3-0-1/Patient?name=Connectathon15", request)
      
      // expected URL and operator can be passed as parameters from test script.
      assertRequestURL("fhir3-0-1/Patient?name=Connectathon15", "contains", request)
      
      assert request.getURL().contains("fhir3-0-1/Patient?name=Connectathon15"): "The actual value
         \""+request.getURL()+"\" did not contain the expected value
            \"fhir3-0-1/Patient?name=Connectathon15\" for URL in request"
      
      assert contains("fhir3-0-1/Patient?name=Connectathon15", request.getURL()): "The actual value
         \""+request.getURL()+"\" did not contain the expected value
         \"fhir3-0-1/Patient?name=Connectathon15\" for URL in request"
      
  • assertRequestURLNotContains(expectedValue)

    • Asserts that the URL of the request does not contain the provided expectedValue

    • Example:

      request.assertRequestURLNotContains("fhir3-0-1/Patient?name=Connectathon15")
      
    • Equivalent to these:

      assertRequestURLNotContains("fhir3-0-1/Patient?name=Connectathon15", request)
      
      // expected URL and operator can be passed as parameters from test script.
      assertRequestURL("fhir3-0-1/Patient?name=Connectathon15", "notContains", request)
      
      assert !request.getURL().contains("fhir3-0-1/Patient?name=Connectathon15"): "The actual value
         \""+request.getURL()+"\" contained the expected value \"fhir3-0-1/Patient?name=Connectathon15\"
            for URL with operator 'notContains' in request"
      
      assert notContains("fhir3-0-1/Patient?name=Connectathon15", request.getURL()): "The actual value
         \""+request.getURL()+"\" contained the expected value \"fhir3-0-1/Patient?name=Connectathon15\"
            for URL with operator 'notContains' in request"
      

Request URL Prefixes

The expectedValue in requestURL can be prefixed for fine-grained assertion of individual parts of the URL.

Prefix

Description

Operators

Example

schemeHostPortPath:
Validates the scheme, host, port, and path.
equals, notEquals
“schemeHostPortPath: http://hostname:11111/fhirSys1”


contains, notContains
“schemeHostPortPath: http://hostname:11111/fhir”
schemeHostPort:
Validates the scheme, host, and port.
equals, notEquals
“schemeHostPort: http://hostname:11111”


contains, notContains
“schemeHostPort: http://hostname:111”
schemeHost:
Validates the scheme and host.
equals, notEquals
“schemeHost: http://hostname”


contains, notContains
“schemeHost: http://hos”
scheme:
Validates the scheme.
equals, notEquals
“scheme: https”


contains, notContains
“scheme: http”
hostPortPath:
Validates the host, port, and path.
equals, notEquals
“hostPortPath: hostname:11111/fhir”


contains, notContains
“hostPortPath: hostname:111”
hostPort:
Validates the host and port.
equals, notEquals
“hostPort: hostname:11111”


contains, notContains
“hostPort: hostname:1”
host:
Validates the host.
equals, notEquals
“host: hostname”


contains, notContains
“host: hostna”
path:
Validates the path portion of the URL.
equals, notEquals
“path: /fhir”


contains, notContains
“path: /fhi”


empty, notEmpty
“path:”
query:
Validates the query portion in the URL.
equals, notEquals
“query: ?family=Chalmers&birthDate=1973-12-01”


contains, notContains
“query: ?family=Chalm&birthDate=1973-12”


empty, notEmpty
“query: ?”
queryParam:
Validates a single query parameter.
equals, notEquals
“queryParam: ?family=Chalmers”


contains, notContains
“queryParam: ?birthDate=1973-12”


empty, notEmpty
“queryParam: ?family”