Assert/IF against variables using template strings

about a year ago by Andrew Mendelsohn

Now you can create assertions and IF conditions against template strings. Most notably, template strings can include references to variables.


  1. Here we assert that the inner text of an <h3> element has the expected text contained in the existing variable expected_value. The {{@variableName}} syntax tells mabl to substitute the value of the variable here.
  1. Step number 3 is an example of an IF conditional using a variable substitution for {{@app.url}}. Because the href value also has a / at the end, the pattern we use for the expected value is {{@app.url}}/.

You can combine these variable substitutions with any other text, or even combine multiple variables together like this: {{@first_name}} {{@last_name}}

You can now assert that one variable is equal to another, by selecting a variable as the source for the comparison, and using a template string to compare to a variable value.