Skip to main content
Version: 25.4

assert

Command

When you run an assert command, SenseTalk evaluates the specified condition (an expression) as true or false. If it is evaluated as false then by default assert throws an exception. It can also log a success, failure, or warning, depending on how the behavior is set. (Added in SenseTalk 1.72)

Examples:

Simple:

Assert that ["iOS","Android","Windows","MacOS"] contains SUTPlatform // Asserts that the value stored in SUTPlatform is one of 4 acceptable values and if not, throws an exception to stop the execution.

English-like:

put ReadText("ResultsUpperLeft","ResultsLowerRight") into UnfilteredResults // Uses OCR to read a number from the SUT and stores it in variable UnfilteredResults
Tap "Filter" // Performs an action on the SUT that causes a filter to be turned on
WaitFor 10, "FilterOn"
put ReadText("ResultsUpperLeft","ResultsLowerRight") into FilteredResults
assert FilteredResults is less than UnfilteredResults with Warning // Asserts that the number read by OCR after applying a filter on the SUT is smaller than before applying the filter

Further Reading

Resources in our other reference manuals.

Related terms in the SenseTalk Dictionary.