Question

I am developing an automated test suite to get the timing information for some Android applications (whose source code I do not have access to).

I haven't decided whether to use MonkeyRunner or Robotium yet. My main concern is after I perform an action on the UI (say typed an URL), how to determine when Android has fulfilled my request, all of the next activity's components are ready for use and I am ready to get the result and take the next action (say the page I requested is fully loaded, or email is fully opened).

For web-browser this is simple, I can just use onProgressChaged() or onPageFinished(). But I am looking for a more general way which works for all applications. I think Instrumentation.waitForIdleSync() or Instrumentation.waitForIdle() might be my best bet here.

However, as far as the documentation I read about MonkeyRunner and Robotium, none of them seem to integrate with waitForIdle well. In Robotium I could send some input and then get the output, but there doesn't seem to be a simple way for me to know when the output is ready, and maybe invoke a callback at that point. MonkeyRunner is similar in this aspect, too.

So I wonder is there a simple way for me to know what time my request has been fulfilled (as perceived by the user) without re-implementing Robotium functionality all by my own?

Thanks a lot.

Was it helpful?

Solution

This can be very tricky and entirely dependent on what exactly you asked monkeyrunner to do. For example, if you have a monkeyrunner script, and issued a command to launch calculator app, you can have a python subprocess monitoring adb logcat -b events output to determine whether calculator app has been launched or not. If you are asking to press a button in the calculator, you can have a sleep of 1 or 2 seconds.

But there is no direct way to determine whether android has processed your event or not. Simply because, every operation differs and takes its own time.

OTHER TIPS

You can put asserts in robotium and then use system.nanoseconds() before and after like a timer.

This might be a easy way to get timing information

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top