Reputation: 8790
I am try yo test the login scenario using Robotium. My confusion is that, how could I test following:
Case 1: If some error occurs during the web service call and a dialog is displayed randomly, how can I handle that. As I'm not sure if this dialog will appear.
Case 2: If this thing is handled, will the test be a fail or a pass? Because for a successful login, user should navigate to next screen.
Upvotes: 0
Views: 794
Reputation: 5809
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.
Upvotes: 2