Handle Random Dialogs Using Robotium
Solution 1:
You know when and where this dialog can happen so its possible to place in code to handle the dialog. for instance:
lets say you have some code like this
solo.clickOnView(view1);
solo.clickOnView(view2);
and you know the dialog can appear between these two steps of your test, you can place in code that is something like:
if(solo.waitForView(dialogView, 1000, false)){
solo.clickOnView(dialogDismissButton);
solo.clickOnView(view2) //retry the step above
}
If its possible the erro can happen again it might make sense to put these calls into function and recursively/loop through trying this cycle for a length of time before failing the test.
As for case 2. Well this depends on your success criteria, ideally if I was you i would try to remove any external dependancies that cause the above error so it never happens but if you are stuck with it being flaky. Well does a user consider this to be an error? I would probably say that if your production app is failing to login very often then something is wrong with the app and I would fail that step and not implement the points above, but thats my interpretation, speak to the business analyst/customer/end users and get their perspective.
Post a Comment for "Handle Random Dialogs Using Robotium"