Re: How to Handle Unhandled exception
Posted: Mon Jan 08, 2018 7:56 pm
If that is the case, then you should not be using the popup watcher at all. If you want the test to fail when that specific unhandled exception happens, then don't handle it and if your System Under Tests (SUT) can't continue then Ranorex will fail because it won't be able to continue executing the test with the exception in place.
The popup watcher should only be used to handle popups where the system/test should not fail, but needs to handle the popup in some way to allow the test to continue WITHOUT failure. The popup watcher is not designed for effective use as a test error handler.
If your test should fail due to a popup, then you should code the test so that it can't continue if the popup is there, using a Validate.NotExists(<Popup>) or something similar, or just letting Ranorex fail when trying to find/act on the next element.
In addition, the popup watcher runs in a separate thread than the test itself, and therefore will not be able to stop the test on a failure. The best you can do is create your callback method in such a way that it passes failure to the report via a Report.Failure() call. You will need to code your own callback for this though.
The popup watcher should only be used to handle popups where the system/test should not fail, but needs to handle the popup in some way to allow the test to continue WITHOUT failure. The popup watcher is not designed for effective use as a test error handler.
If your test should fail due to a popup, then you should code the test so that it can't continue if the popup is there, using a Validate.NotExists(<Popup>) or something similar, or just letting Ranorex fail when trying to find/act on the next element.
In addition, the popup watcher runs in a separate thread than the test itself, and therefore will not be able to stop the test on a failure. The best you can do is create your callback method in such a way that it passes failure to the report via a Report.Failure() call. You will need to code your own callback for this though.