开发者

Android - issue in controlling builtin app using Robotium

I am writing an android testing application which automates testing on the device.

I am targeting facebook as my base application and writing an app using the Robotium framework in order to accomplish my requirement.

Until now i have successfully implemented a few features, but I am stuck at one point: I want to automate the "upload picture" functionality, but as soon as the upload button is clicked, the device builtin application gets activated. I could 开发者_开发知识库not control the default app using Robotium.

Is there any way to solve this, by writing some code using robotium or writing a layer between the OS and Robotium which can generate key stokes?


I don't think you can do that. However you might be able to make your own modified version of the built-in application and use that instead (if you can make it default and so not have to go through a selection screen), or root a phone and break its security model to use as an automated testing device.


You said

a layer between the OS and Robotium.

If you were ok with that, there is the black-box UIAutomator-Framework by google, which might be able to do that. Additionally,

You might want to use monkeyrunner like this:

$ monkeyrunner
>>> from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
>>> device = MonkeyRunner.waitForConnection()
>>> device.touch(200, 400, MonkeyDevice.DOWN_AND_UP)

You can also do a drag, start activies etc. Have a look at the api for MonkeyDevice.

(from this SO answer).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜