Test exception handling
Let’s think of a video app and you want to test if some sort of offline download is working. Let’s further assume that the app sometimes asks the user to rate the app by showing a special dialog one out of 10 times the user starts the app.
This would result in your tests to fail one out of 10 times because your test would not know how to deal with the rating popup.
Exception handlers to the rescue!
How does it work?
- Record a short test which takes care of closing the rating popup. (This might even be just a single step) and save it.
- Add this test to your test batch as an exception handler.
- As soon as your test batch fails, your close-the-dialog exception handler will take care of closing the dialog. For each exception handler you can define whether you would like to retry the current test step afterwards or whether you would like to retry the whole test.
There are 2 modes you can use for each exception handler:
Retry step: If exception handler succeeds, the original test will be picked up right at the step which failed before.
Retry test: If exception handler succeeds, the original test will be picked up right from the first step. So basically the whole test will be executed again.
It's possible to add more than one exception handler to your test. If the first one fails, the second one will be executed, if this one fails the third one, and so on...