相关疑难解决方法(0)

如何为Android中的深层链接编写测试?

我想使用UI测试框架(Espresso)为深度链接案例编写Android应用程序测试 - 仅使用ACTION_VIEW意图启动应用程序并检查打开屏幕上的所有视图.

但看起来像Espresso(甚至espresso-intents)没有这个功能,并且需要定义Activity类.

我试过这种方式,但它无法正常工作,因为启动了两次应用程序 - 使用AppLauncherActivity标准启动(Espresso需要)并通过深层链接启动.

@RunWith(AndroidJUnit4.class)
public class DeeplinkAppLauncherTest {

    @Rule
    public ActivityTestRule<AppLauncherActivity> activityRule = new ActivityTestRule<>(AppLauncherActivity.class);

    @Test
    public void testDeeplinkAfterScollDownAndBackUp() {
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("myapp://search/777"));
        activityRule.launchActivity(intent);

        onView(withId(R.id.search_panel)).check(matches(isDisplayed()));
    }

}
Run Code Online (Sandbox Code Playgroud)

我想在没有标准启动的情况下仅使用深层链接启动测试应用程序.你知道吗,怎么办?

android deep-linking android-testing android-espresso

8
推荐指数
1
解决办法
1649
查看次数

Android monkey test选择一个特定的活动

我正在使用Android猴子测试来测试我的Android应用程序,它适用于我的应用程序,非常酷.但是我想特定地测试一个应用程序活动,我该怎么做?

今天我正在测试所有应用程序:

$ adb shell monkey -p my.package -c android.intent.category.HOME -c android.intent.category.DEFAULT -v 500 -s "a random number"
Run Code Online (Sandbox Code Playgroud)

android monkey-testing android-activity

6
推荐指数
2
解决办法
1万
查看次数