Advertisement

Kotlin unit testing methods

阅读量:

本文件为个人博客系统文档的备份版本,作者:小游,作者博客:点击访问

单元测试是一项不可或缺的能力

添加必需的依赖项

复制代码
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:rules:1.3.0'
    //    testImplementation  'androidx.test.ext:junit:1.1.2'
    testImplementation  'androidx.test.espresso:espresso-core:3.3.0'
    
    
      
      
      
      
    

接下来我们着手编写用于测试的函数

复制代码
    import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
    @RunWith(AndroidJUnit4ClassRunner::class)
    class ExampleInstrumentedTest {
    
    // 测试数据库连接
    @Test
    fun getAllResult(){

全部评论 (0)

还没有任何评论哟~