如何处理外部应用程序的活动中使用robotium机器人如何处理、机器人、应用程序、活动中

2023-09-07 11:33:12 作者:仅有的自尊

我想用自动化robotium Android应用程序(搬迁服务)。在这个程序有媒体部分,电子邮件和电话本地拨号选项,以便当我点击任何该选项(视频,音频,电话,电子邮件),它需要你的本机应用程序(视频,音频,电话,电子邮件)电话。因此,如何利用robotium来处理外部应用程序的活动(像点击后退按钮回来我的应用程序,或关闭本机相机或视频应用程序,回来我的应用程序)

I am trying to automate android app(Relocation services)using robotium. In this app there are media section and email and phone native dialer options so when i click on any of this option(Video, audio, phone, email) it takes you to the native app(video,audio, phone, email) of the phone. So how to handle external application activity using robotium(Like click on back button to come back to my app, or close native camera or video app to come back to my app)

所有的答案将是很大的帮助。

Any answer will be great help.

推荐答案

我认为,使用 Robotium 你不能从你的目标的测试应用程序访问其他应用程序资源。

I think, Using Robotium you can't access other application resources from your target testing application.

只需使用仪表此,

Instrumentation inst = new Instrumentation();
inst.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK);

不过可以肯定的,如果你这样做是在活动然后把它放进单独的线程来运行这个code ..

But be sure if you are doing this in Activity then put this in separate thread for run this code..