Latka XML Reference

byteLength

validates the length of an HTTP(S) response

DTD

<!ELEMENT byteLength EMPTY>
<!ATTLIST byteLength min   CDATA "0"
                     max   CDATA #IMPLIED
                     label CDATA #IMPLIED>

Attributes

Name Type Default Description
min NUMBER 0 Minimum number of bytes required for a valid response. Implied. Defaults to 0 .
max NUMBER none Maximum number of bytes required for a valid response. Optional. When absent, there is no upper limit on the number of bytes in a valid response.
label CDATA none Label associated with this validation, which may be used in programatically generated documentation or reports. Optional.

Parents

Description

A byteLength validation passes if the HTTP(S) response is at least min bytes long, and (when specified) at most max bytes long.

cookie

validates the presence of an HTTP(S) cookie in a response

DTD

<!ELEMENT cookie EMPTY>
<!ATTLIST cookie name  CDATA #REQUIRED
                 value CDATA #IMPLIED
                 label CDATA #IMPLIED>

Attributes

Name Type Default Description
name CDATA none, but required The name of the cookie to look for. Required.
value CDATA none, optional The value that the cookie with the specified name should have (if any).
label CDATA none Label associated with this validation, which may be used in programatically generated documentation or reports. Optional.

Parents

Description

A cookie validation passes if the HTTP(S) response contains a cookie with the specified name . If a value is provided, the cookie must also have the specified value.

credentials

username/password credentials for Basic HTTP authentication.

DTD

<!ELEMENT credentials EMPTY>
<!ATTLIST credentials userName CDATA #REQUIRED
                      password  CDATA #REQUIRED>

Attributes

Name Type Default Description
userName CDATA none, required User name. Required.
password CDATA none, required Password. Required.

Parents

Description

Contains credentials for HTTP Basic Authentication.

maxRequestTime

validates the response time for an HTTP(S) request

DTD

<!ELEMENT maxRequestTime EMPTY>
<!ATTLIST maxRequestTime millis CDATA "30000"
                           message  CDATA #IMPLIED>

Attributes

Name Type Default Description
millis NUMBER 30000 Maximum amount of time, in milliseconds, in which a response must be returned to be considered a valid response. Implied. Defaults to 30000 milliseconds, or 30 seconds.
label CDATA none Label associated with this validation, which may be used in programatically generated documentation or reports. Optional.

Parents

Description

A maxRequestTime validation passes if the HTTP(S) response is obtained in no more than millis milliseconds.

param

indicates a request parameter as part of an HTTP(S) request to be executed

DTD

<!ELEMENT request (paramName, paramValue)>

Attributes

None.

Parents

Description

A parameter to be submitted as part of a request .

paramName

the name part of a name/value pair parameter

DTD

<!ELEMENT paramName (#PCDATA)>

Attributes

None.

Parents

Description

The name part of param to be submitted as part of a request .

paramValue

the value part of a name/value pair parameter

DTD

<!ELEMENT paramValue (#PCDATA)>

Attributes

None.

Parents

Description

The value part of param to be submitted as part of a request .

regexp

validates the presence or absence of a regular expression within an HTTP(S) response

DTD

<!ELEMENT regexp EMPTY>
<!ATTLIST regexp pattern    CDATA          #REQUIRED
                 cond       (true | false) "true"
                 ignoreCase (true | false) "false"
                 label       CDATA         #IMPLIED>

Attributes

Name Type Default Description
pattern CDATA none, but required. The regular expression to look for.
cond Enumeration:
  • true
  • false
true When true , the given pattern must match within the response. When false , the given pattern must not match within the response.
ignoreCase Enumeration:
  • true
  • false
false When true , case is ignored within the given pattern .
label CDATA none Label associated with this validation, which may be used in programatically generated documentation or reports. Optional.

Parents

Description

A maxRequestTime validation passes if the HTTP(S) response is obtained in no more than millis milliseconds.

request

indicates an HTTP(S) request to be executed

DTD

<!ELEMENT request (credentials?, param*, validate?)>
<!ATTLIST request path   CDATA        #REQUIRED
                     method (post | get) "get"
                     host   CDATA        #IMPLIED
                     port   CDATA        #IMPLIED
                     label  CDATA        #IMPLIED>

Attributes

Name Type Default Description
path CDATA none, but required Request path. Required.
method enumeration:
  • get
  • post
get HTTP method. Implied. Defaults to get .
host CDATA none Host to submit request to. Optional. When absent, uses default from suite .
port NUMBER depends upon protocol Port to submit request to. Optional. When absent, uses default from suite .
label CDATA none Label associated with this validation, which may be used in programatically generated documentation or reports. Optional.

Parents

Description

An HTTP(S) request to be executed.

session

wrapper for a sequence of request s associated with the same state (session)

DTD

<!ELEMENT session (request+)>
<!ATTLIST session sessionId CDATA #IMPLIED
                     label      CDATA #IMPLIED>

Attributes

Name Type Default Description
sessionId CDATA none Unique identifier for this session . Sessions with the same sessionId will share the same underlying state (e.g., cookies, etc.)
label CDATA none Label associated with this session , which may be used in programatically generated documentation or reports. Optional.

Parents

Description

A session is a collection of request s that share the same underlying state. For example, a cookie that returned in the response to one request will be included in subsequent request s.

statusCode

validates an HTTP response code

DTD

<!ELEMENT statusCode EMPTY>
<!ATTLIST statusCode code  CDATA "200"
                      label CDATA #IMPLIED>

Attributes

Name Type Default Description
code NUMBER 200 Numeric HTTP response code to expect. Implied. Defaults to 200 .
label CDATA none Label associated with this validation, which may be used in programatically generated documentation or reports. Optional.

Parents

Description

A statusCode validation passes if the HTTP(S) response code for the given request matches the value specified by code .

suite

root element for a suite of tests

DTD

<!ELEMENT suite ( (session | request)+ )>
<!ATTLIST suite defaultHost CDATA #IMPLIED
                   defaultPort CDATA #IMPLIED
                   label        CDATA #IMPLIED>

Attributes

Name Type Default Description
defaultHost CDATA none Default hostname for request s. Optional.
defaultPort NUMBER none Default port for request s. Optional.
label CDATA none Label associated with this suite , which may be used in programatically generated documentation or reports. Optional.

Parents

None.

Description

A suite is a collection of request s and session s to execute.

validate

indicates th e suite of validations to apply to the current request (and its response)

DTD

<!ELEMENT validate (byteLength | cookie | maxRequestTime | regexp | statusCode | xpath )+>

Attributes

None.

Parents

Description

Contains the set of validations to apply to the current request (and its response).

xpath

xpath - assuming the HTTP(s) response contains XML, checks if an XPath expression matches

DTD

<!ELEMENT xpath EMPTY>
<!ATTLIST xpath select    CDATA          #REQUIRED
                   cond       (true | false) "true"
                   value     CDATA          #IMPLIED
                   label     CDATA          #IMPLIED>

Attributes

Name Type Default Description
select CDATA none An XPath expression, designed to match a node in the XML body of the response.
cond Enumeration:
  • true
  • false
true When true , the given XPath expression must match within the response. When false , the given XPath expression must not match within the response.
value CDATA none, optional The value that the matched node should have, if any.
label CDATA none Label associated with this validation, which may be used in programatically generated documentation or reports. Optional.

Parents

Description

A xpath validation passes if the HTTP(S) response body contains XML, and the specified XPath expression matches (or not, depending on cond)