Creating Asserts during Automation

Updated 2 months ago by SYED A HAMID

An Assert is a Boolean expression that is added at a specific point in a test script to validate a condition which will be true unless there is a bug in the program. A test assertion is defined as an expression, which encapsulates some testable logic specified about a target under test.

Validate an assert function

Asserts are created when you create Nocode Automated Test. To validate an Assert function, you should enable Assert Mode. To do that, complete the following steps:

  1. Click the Assert icon in the Action Bar.
  2. When you enter Assert Mode, you will see a red icon at the top right of the user interface. At this point you are able to select any of the individual controls and create assertions to validate the existence (or non-existence) of a control or Text.
  3. What follows are explanations of various Assert Rules. As an example, Test Component's Content. can be used to verify text on a Button or Label. The example below uses Equals Exact Match to ensure SIGN IN button appears on this page. When entering Assert value, you specify the value or use a Test Data variable.

Table of Assert Functions

The following table describes how various Assert functions are used in Sofy:

Assert function

Component

Description

Test Component's Content should be Equal

Button, Labels, TextBox

Text of the component matches with string that is compared

Test Component's Content should not be Equal

Button, Labels, TextBox

Text of the component does not matches with string that is compared

Test Component's Content should contain

Button, Labels, TextBox

Text of the component contains within string that is compared

Test Component's Content should not contain

Button, Labels, TextBox

Text of the component does not contains within string that is compared

Test Component is present

Any Element

The component is present in current view

Test Component is not present

Any Element

The component is present is not in current view

Test Component is checked

Checkbox

The component is checked

Test Component is Unchecked

Checkbox

The component is unchecked

Test Component is Enabled

Button, TextBox

The component is enabled for data entry or selection

Test Component is Disabled

Button, TextBox

The component is enabled for data entry or selection

Related Video: Adding Asserts in Sofy


How did we do?