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

后端 未结 8 716
星月不相逢
星月不相逢 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

    0 讨论(0)
  • 2021-01-17 11:58

    I got this error when I have some parameters in my test method. So, if you have it - delete it.

    @Test
    fun someTestMethod(someParams: Int) { // delete method params
        assert(1==1)
    }
    
    0 讨论(0)
提交回复
热议问题