OnError method is not being invoked
In Silk Test Workbench, when using the ‘On Error’ test step, error handling does not fire when an error is encountered, the script continues to execute. What can I do to resolve this?
Please ensure that the ‘On Error’ test step is placed before the test step which is likely to cause an error else the ‘On Error’ method will not catch the error message and the associated actions to take will not be executed.
Please see the screenshot above which demonstrates the use of the On Error test step and that it is placed before step 4 which is will invoke an error. The sample application can be found at http://demo.borland.com/InsuranceWebExtJS/index.jsf
In the example, the first recorded step was to click the error labels that are displayed when the login button is clicked without entering a valid username or password. Please see the screenshot below which shows the labels in question.
- As these labels do not exist when the page is first loaded, the test will fail with an object not found exception.
- The On Error test step is inserted before the test step likely to cause an error message.
- A label is inserted via the Insert -> Label menu to direct the script when the error is encountered, this is demonstrated in the first screenshot in step 6.
- The test steps proceeding the ‘Label’ test step enters the details into the username and password fields, followed by a click on the login button.
For more information on the ‘On Error’ test step please see the ‘On Error Go To Properties’ topic within the Silk Test Workbench Help.