0

My app has an activity which loads some images from server. So, naturally it takes some time to load the activity completely, as it is fetching images from server.

I need to know when the activity loads completely from Monkeyrunner. And if it creates Error when fetching images from server, how I can know about this Error from Monkeryrunner.

Please advise me.

arefin
  • 365
  • 3
  • 17
  • How the error is shown? Is it a dialog? How do you know is still loading? – Diego Torres Milano Jul 12 '13 at 20:08
  • Basically I am using ProgressDialog to show "Loading..." in my app. So, when loading is completed then te dialog is vanished. I need to know how I can know this from Monkeyrunner. If any error occurs (may be crash), how I can know this? – arefin Jul 12 '13 at 20:36
  • @dtmilano: do you have any idea? – arefin Jul 12 '13 at 20:45

1 Answers1

1

This would not be exactly the same as your app but you'll get the idea. The solution is based on AndroidViewClient/culebra.

I'm using the Progress dialog example from API Demos so it will be easily reproducible by anyone.

When you press API Demos -> App/Alert Dialogs you obtain

Progress dialog

then you can run culebra to automatically generate a test script

$ culebra -VC -t on -r -o myscript.py

edit the script to remove the unneeded Views and loop while progress is being incremented

# generated script lines removed for clarity
while True:
    vc.dump(window='-1')
    no_id15 = vc.findViewWithTextOrRaise(re.compile('\d+/100'))
    print no_id15.getText()

the output would be

Connecting to a device with serialno=.* with a timeout of 60 secs...
Connected to device with serialno=.*
Actual device serialno=emulator-5554
21/100
24/100
26/100
28/100
...
98/100
100/100
Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134