【问题标题】:How to run android instrument test on physical device?如何在物理设备上运行 android 仪器测试?
【发布时间】:2021-05-11 03:07:06
【问题描述】:

当我在物理设备上运行仪器测试时,出现错误:

测试框架意外退出。测试运行失败:进程崩溃。

我的测试根本不运行,无论它想要成功还是失败。

Testing started at 12:50 AM ...

02/07 00:50:14: Launching 'insertWeather()' on Physical Device.
App restart successful without requiring a re-install.
Running tests

$ adb shell am instrument -w -m  --no-window-animation  -e debug false -e class 'com.example.myapplication.DataSourceLocalAndroidTest#insertWeather' com.example.myapplication.test/androidx.test.runner.AndroidJUnitRunner
Connected to process 4456 on device 'xiaomi-mi_a3-18ba949a89be'.
Test running failed: Process crashed.
Tests ran to completion.

Android Studio : 4.1.2 ____ 我的手机 : Xiaomi Mi A3, android 10

@RunWith(AndroidJUnit4::class)
class DataSourceLocalAndroidTest {

    @Test
    fun insertWeather() {
        assertEquals(0, 0)
    }

}

【问题讨论】:

    标签: android testing device


    【解决方案1】:

    我必须在 gradle 中添加了以下依赖项:

        // Required for instrumented tests
        androidTestImplementation 'androidx.test:runner:1.3.0'
    

    【讨论】:

    • 你是怎么想出来的,我是说哪里有文件?
    猜你喜欢
    • 1970-01-01
    • 2021-01-26
    • 1970-01-01
    • 2019-05-02
    • 2016-01-29
    • 2012-08-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多