Adding 'Contains' as a verification type in a Visual test

Verifications allow for items to be validated as the script executes. In Visual tests, there is a predefined list of verification types that can be used. This list has been extended to include Contains and Does not Contain functionality for text types.
These new types can be used wherever a condition can be created, for example in if statements, in verifications, or in repeat loops. They have also been added as a function that can be used in an expression.

Using 'Contains' in a Verification

In this example, the text control of Notepad has been selected and the verification is being created against the text control. The Select the condition now includes two extra entries, Contains and Does not Contain.

Figure 1: Contains and Does not Contain condition types.

This creates a step in the Visual test that looks something like this

The Condition Designer allows you to change the type of Verification. You can change the type by editing the value in the Operator column.

Figure 2: Condition Designer allows editing.

Conditions in other statements

Since these new types are an extension of the condition types that are available to a Visual test, these types can be used wherever conditions can be defined, for example if statements and repeat loops. 

Expressions

To complement this functionality in conditions, a new function has also been created for use in expressions using the Expression Designer. The function is named Contains() and takes two string parameters, the string in which to search and the string to search for. The function returns true if the string was found or false if it was not found.

Figure 3 : Using Contains() in the Expression Designer

Conclusion

The addition of this functionality gives Visual test users more flexibility when validating their application or when making decisions based on data.