简体   繁体   English

如何在物理设备上运行 android 仪器测试?

[英]How to run android instrument test on physical device?

When I run instrument test on physical device, I get an error:在物理设备上运行仪器测试时,出现错误:

Test framework quit unexpectedly.测试框架意外退出。 Test running failed: Process crashed.测试运行失败:进程崩溃。

My test does not run at all, if it wants to succeed or fail.如果它想要成功或失败,我的测试根本不会运行。

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 ____ My phone: Xiaomi Mi A3, android 10 Android Studio:4.1.2 ____ 我的手机:小米米A3,android 10

@RunWith(AndroidJUnit4::class)
class DataSourceLocalAndroidTest {

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

}

I must have added following dependency to gradle:我必须向 gradle 添加以下依赖项:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何一次在多个设备上运行 android Instrument 测试 - How to run android Instrument test on Multiple devices at a time Android检测的单元测试将无法在一个物理设备上运行 - Android instrumented unit test will not run on one physical device 如何在 Android Studio 中将我的物理设备作为模拟器运行? - How can I run my physical device as an emulator in Android studio? 如何强制 react-native 项目在物理 android 设备上运行? - How to force react-native project to run on a physical android device? Android Espresso 测试在物理设备上失败(PerformException) - Android Espresso test failed on physical device (PerformException) 为什么Android应用无法在物理设备上运行? - why android app does not run on physical device? 仅在物理设备而非模拟器上运行 Android 应用 - Run Android app Only on Physical Device not Emulator 如何在物理设备上运行 sencha 应用程序 - how to run sencha app on a physical device 如何在IONIC 3物理设备上运行我的应用 - How to run my app on an IONIC 3 physical device 如何通过蓝牙与Matlab'Instrument Control'-Toolbox连接android设备? - How to connect android device via bluetooth with matlab 'Instrument Control'-Toolbox?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM