Delegate runner 'androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner' for AndroidJUnit4 could not be loaded

后端 未结 8 777
星月不相逢
星月不相逢 2021-01-17 11:30

I try to run Kotlin instrumentation tests for android.

In my app/build.gradle:

    android {
        dataBinding {
            enabled = true
               


        
8条回答
  •  时光取名叫无心
    2021-01-17 11:55

    I faced this problem in kotlin , used below code and it worked

    @RunWith(AndroidJUnit4::class)
    
    @LargeTest
    
    class MainActivityTest {
    
        private val TAG = "MainActivityTest"
    
        @get:Rule
        val activityRule = ActivityTestRule(MainActivity::class.java)
    }
    

    follow the link below:- https://developer.android.com/training/testing/junit-rules

提交回复
热议问题