簡體   English   中英

如何在物理設備上運行 android 儀器測試?

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

在物理設備上運行儀器測試時,出現錯誤:

測試框架意外退出。 測試運行失敗:進程崩潰。

如果它想要成功或失敗,我的測試根本不會運行。

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 ____ 我的手機:小米米A3,android 10

@RunWith(AndroidJUnit4::class)
class DataSourceLocalAndroidTest {

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

}

我必須向 gradle 添加以下依賴項:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM