Regular expressions used in a SilkTest Workbench Visual Test verification
There exists a textfield object in my application. This object is populated at runtime with a dynamic value and we would like to verify this value but ignoring the dynamic part of the value.
For example, to verify whether a string "XXXX 123123 XXXXX" will appear in a control, the number part of the string is dyanmic. How can we perform a verification against this value in a Visual Test?
This type of comparison requires the use of wildcards. We recommend using a .NET script to perform the comparison, then pass the result of the comparison to the Visual Test. This Knowledge Base article, #33922, details steps on capturing values from a .NET script and passing the value to a Visual Test.
VB.NET allows you to perform wildcard comparisons using the Like operator
Dim s As String
s = "XXXX 123123 XXXXX"
If s Like "XXXX * XXXXX" Then
The wildcards you can use in this scenario are:
* - denotes any number of characters
? - denotes a single character