Action
Verifies that the expected value equals the actual value and enables you to add a comment.
Syntax
result = Workbench.Verify(expected, actual, [comment])
Variable
|
Description
|
result
|
Whether the verification was successful.
BOOLEAN.
|
expected
|
The value that you expect the script to return.
OBJECT.
|
actual
|
The actual value that the script returns.
OBJECT.
|
comment
|
Optional: The comment to include.
STRING.
|
Examples
To compare the expected value with the actual value and add a comment, type:
Workbench.Verify(expected As Object, actual As Object, comment As String)
For example,
Workbench.Verify("red", "green", "checking colors") fails with the message
checking colors - Actual: [green]; Expected: [red].
To verify the value returned by the expected result and add a comment, type:
Workbench.Verify(condition As Boolean, comment As String)
For example,
Workbench.Verify(True, "Test Passed") passes. While
Workbench.Verify(False, "Test Failed") fails.
To compare the actual value with the expected value for IEnumerable objects, such as lists and arrays, type:
Workbench.Verify(expectedEnumerable, actualEnumerable)
For example:
Dim selectedItemsList = listBox.SelectedItems ' we assume that a list with the items "red" and "blue" is returned
Dim expectedItemsList = New List(Of String)()
expectedItemsList.Add("red")
expectedItemsList.Add("blue")
Workbench.Verify(selectedItemsList, expectedItemsList) ' verification passes
Dim expectedItemsArray = New String() { "red", "blue" }
Workbench.Verify(selectedItemsList, expectedItemsArray) ' verification passes
Note: Two IEnumerable objects are considered equal if both have the same number of elements, and the elements are equal and in the same order.
Note: Mathematical operations with floating point numbers may lead to two numbers that are not completely identical because of their internal representation, although they should be equal from a user point of view. Therefore, floating point numbers (Double, Single) are considered equal if their difference is less than 0.00001. At times, this value may not be correct for the situation. In this case, compare the two values with the
Verify(result As Boolean) instead.