Migrating Junit4 tests to androidx: What causes 'delegate runner could not be loaded'?

后端 未结 19 1801
长情又很酷
长情又很酷 2020-12-05 06:35

I am migrating my app to androidx, I can\'t seem to get my unit tests working. I took example from Google\'s AndroidJunitRunnerSample, which has been updated to use the new

相关标签:
19条回答
  • 2020-12-05 07:05

    As for my case, defining a function parameter was the problem.

    @Test
    fun foo(string: String = "") {  // Causes "Delegate runner could not be loaded" error.
        // ...
    }
    

    I had to do something like the following.

    @Test
    fun foo() {
        foo("")
    }
    
    fun foo(string: String) {  // Can be called from other test functions.
        // ...
    }
    
    0 讨论(0)
提交回复
热议问题