Compare

A compare assertion is used to compare 2 values. There is such thing as in this assertion type as comparator - an operation that compares two values. There are several comparator types:

  • equal - checks if the values are equal;

  • not equal - checks if the values are not equal;

  • greater - checks if the current value is greater than the expected one;

  • greater or equal - checks if the current value is greater than or equal to the expected one;

  • less - checks if the current value is less than the expected one;

  • less or equal - checks if the current value is less than or equal to the expected one.

The compare assertion interface is as follows:

The compare assertion interface

The following fields are shown in the screenshot:

  • Actual value;

  • Operator - the comparator type;

  • Expected value.

Error Fixing

The error fixing algorithm depends on the comparator type.

  • equal - the current value is assigned to the expected one;

  • not equal - the comparator type changes to equal;

  • greater - the comparator type changes to greater or equal and the current value is assigned to the expected one;

  • greater or equal - the current value is assigned to the expected one;

  • less - the comparator type changes to less or equal and the current value is assigned to the expected one;

  • less or equal - the current value is assigned to the expected one.

File Representation

The assertion has the compare type in the file. The type description can be found in the Assertion file representation documentation in the #/definitions/CompareAssertion definition.