我开始我的自动化Android应用程序。它具有的条款及细则的屏幕。在此,如果我点击的衰落的,我的应用程序将被关闭。
I started to automate my Android app. It has a "Terms & conditions" screen. In that, if I click on "decline", my app will be closed.
我怎样才能重新启动或在同一进程中重新启动我的应用程序?
How can I relaunch or restart my app within the same process?
试试这个:
// assuming this method is in a ActivityInstrumentationTestCase2 class
public void test_yourTest() {
// do your testing
Solo.sleep(1000);
// killing all your Activities manually if it doesn't by itself anyway
Solo.finishOpenedActivities();
// relaunch your app by calling the same Activity as in the constructor
// of your ActivityInstrumentationTestCase2
this.launchActivity(TARGET_PACKAGE_ID, YourStartActivity.class, null);
Solo.sleep(1000);
// do your testing
}
上一篇:Laravel,sync() - 如何同步数组并传递额外的数据透视字段?数组、字段、透视、数据
下一篇:Android的 - 有困难的非同步调用后更新ListAdapter非同、困难、Android、ListAdapter