安卓Robotium:如何在点击后被测回到我的活动/启动另一个活动 [英] Android Robotium: how to go back to my Activity under test after clicking/launching another Activity

查看:180
本文介绍了安卓Robotium:如何在点击后被测回到我的活动/启动另一个活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的Robotium测试的问题。在我的一个活动之一,我点击一个按钮。点击该按钮可启动另一项活动B.所以在我的robotium测试,我有这样的事情:

I have an issue with my Robotium tests. On one of my Activity A, I am clicking on a button. Clicking on this button launches another activity B. So in my robotium test I have something like this :

Button myBtn = (Button) solo.getView(R.id.myBtn);

所以这个动作之后,仿真器将自动启动活动B.现在的问题是,我没有下在code测试(一)要回活动的任何可能性。

so after this action, the emulator is automatically launching activity B. Now, the problem is that I do not have any possibility of going back to the activity under test (A) in the code.

你能告诉我如何避免触发其推出的按钮,点击时得到关押在b活动?换句话说,是有可能在测试回去的活动呢?

Can you please tell me how to avoid getting jailed in the activity B when clicking on the button that trigger its launch ? In other words, is it possible to go back to the activity under test ?

仅供参考:我需要被测回到活动,因为有其他的测试方法等着被解雇

FYI : I need to go back to the activity under test because there are other test methods waiting to be fired.

在此先感谢,

推荐答案

请尝试像

solo.clickOnView(R.id.myBtn)

点击您的按钮 您也可以尝试

to click on your button You can also try

solo.clickOnButton()

要回到活动,您可以用

solo.goBack();

solo.goBackToActivity("ActivityName");

这篇关于安卓Robotium:如何在点击后被测回到我的活动/启动另一个活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆