Conditions

Building Conditions with Audisto Scripting Language

Conditions consists of so-called scopes and matchers. Scopes extract data from a source - like the path of a URL, or the HTTP status or HTML from a HTTP response. Matchers run tests against the extracted data.

In the following example, the scope is Path, the matcher is Starts With, taking "/user" as an argument. It will become TRUE, if the path of the URL starts with "/user".

Path Starts With "/users"

There's more detailed documentation on scopes and matchers.

Some more examples of scopes and matchers:

HTML Contains "No Products Found"
HTTP Header Contains "Last-Modified"
Response Time Less Than 700

Conditions can be combined with AND and OR.

Path Starts With "/users" AND HTTP Status Equals 200
Response Time Greater Than 700 OR Compressed Content Size Greater Than 40000

Brackets ( and ) can be used to group logical expressions.

Path Starts With "/users" AND
  (HTTP Status Equals 200 OR HTTP Status Equals 302)

Especially if AND and OR are combined, brackets should be used to avoid ambiguities.

Without brackets, expressions are evaluated from left to right.

Conditions can be defined using the condition editor, which offers a drop down box containing all available scopes. Depending on the scope, it shows a list of all possible matchers, and an according input field for the argument.

This is how the visual editor looks:

Shows a screenshot of visual condition editor

You can use Add rule to add a new condition. Add group creates a new logical group, which keeps several conditions together.

Clicking on AND or OR changes the logic applied on the set of rules.

Case Sensitivity

The Audisto Scripting Language is case insensitive regarding keywords. It also ignores white space like spaces or new lines. The following two statements are identical:

CLUSTER "Product Pages" IS:
  Path Starts With "/products"
cluster "Product Pages" iS : PATH starts     wITh "/products"

Code is formatted automatically upon saving.

Quoted Values

Whenever strings are used, either as names or as arguments, they must be quoted using double quotes.

Inside double quotes, double quotes itself must be escaped using the backslash character \. A backslash must be replaced by two backslashes:

  • \ => \\
  • " => \"

The following code will scan HTML for href="mailto:

CLUSTER "Has Mail Link" IS:
  HTML Contains "href=\"mailto:"

Note that quoting and escaping is only required in text editing mode, not when using the visual editor.

Escaping can be prevented by enclosing a text in three quotes.

CLUSTER "Has Mail Link" IS:
  HTML Contains """href="mailto:"""

This makes entering text containing quotes or backslashes more easy. It will get converted to single quotes and escaped content on storing, though.