MeNoVa
MeNoVa

Reputation: 99

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

@RunWith(AndroidJUnit4::class)
class DataSourceLocalAndroidTest {

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

}

Upvotes: 1

Views: 1208

Answers (1)

MeNoVa
MeNoVa

Reputation: 99

I must have added following dependency to gradle:

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

Upvotes: 1

Related Questions