Skip to main content

Assert on Attribute Value

This document is based on MTA version 1.8.

Definition

An Assert on Attribute Value formulates an expected result of an attribute in a Teststep upon execution. It is possible to either define the result to have a single value, or a range that the value should be in. A Teststep can have multiple Asserts on Attribute Value.

An Assert on Attribute Value can be added for:

  • an Attribute Value of a created or changed object;
  • an Attribute Value of a retrieved object. In that case the assert evaluates the Attribute Value of all retrieved objects;
  • the value of a primitive microflow output parameter like string, integer, etc.

Note that there are also Asserts on Object Count, that are added on a retrieve object action, or on a microflow call action.

When a Teststep uses Data Variation to manipulate Teststep input, the Assert can be applied as a Data Variation Item for each defined variation.

Each Assert is evaluated after the execution of a Teststep. A Teststep execution fails when the evaluated value does not match to the defined expectation.

Properties

NameDescription
Compare typeThe type of comparison to be made.
- The 'Equals' / 'Not equals' type means that the attribute value should exactly match (or not match, respectively) a single given value.
- The 'Range' / 'Not range' type means that the attribute value should be within (or outside, respectively) the given boundaries. A 'Range' type is only applicable for numeric or date attributes.
- The 'Greater than' / 'Greater than or equal to' means that the attribute value should be higher than (or include, respectively) the given value.
- The 'Less than' / 'Less than or equal to' means that the attribute value should be lower than (or include, respectively) the given value.
ValueThe expected value of the attribute upon executing the test when the selected compare type is 'Equals'. If the asserted value is empty, the result must be empty in order for the assert to pass.
Min valueThe expected lower boundary of the attribute value if the selected compare type is 'Range'.
Max valueThe expected higher boundary of the attribute value if the selected compare type is 'Range'.
Trim string valuesUsed to be able trim string values for leading and trailing space characters before evaluating the result (only applicable for string attributes).

Business rules

  • The compare type is mandatory.
  • If the compare type is 'Range', both Min and Max values are mandatory.

The following Assert Compare types are supported for the Mendix data types:

StringIntegerDecimalBooleanDatetimeEnumeration
Equals
Does not equal
Contains
Does not Contain
Within Range
Outside of Range
Greater than
Greater than or Equal to
Less than
Less than or Equal to

Actions on an Assert on Attribute Value

View Teststeps that have Asserts

  • All Teststeps in a Test Case with one or more Assert, are marked with in the list of Teststeps.

View attributes that have Asserts

  • All attributes with one or more Assert are highlighted in the Attributes tab in the Details of teststep pane on the right in the Test Suite overview page.
  • If an Assert is included in Data Variation, is also shown.

Add an Assert on Attribute Value

There are multiple ways to add an Assert on Attribute Value:

  1. Navigate to the "Attributes" tab in the "Details of teststep" pane on the right in the Test Suite overview page. Click on next to the attribute to add the Assert;
  2. Hover your mouse on a Teststep and click on to open the page where asserts can be configured;
  3. Click on "Save and configure asserts" after configuring the Teststep. This will show the page where Asserts can be configured. Navigate to the "Attributes" tab, click on the "+ Assertion" button to add the Assert.

Delete an Assert on Attribute Value

  • Open the assertion configuration page and go to the Attributes tab.
  • Click on on the attribute to delete the Assert from.

Feedback?

Missing anything? Let us know!

Last updated 20 september 2022