Skip to content

crazygit/AndroidXTestDemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

使用AndroidX的测试

  1. app/build.gradle添加依赖
testImplementation 'org.robolectric:robolectric:4.3.1'
// 下面的testImplementation依赖和androidTestImplementation一样
// 只是利用robolectric模拟运行环境
testImplementation 'androidx.test.ext:junit:1.1.1'
testImplementation 'androidx.test.ext:truth:1.2.0'
testImplementation 'androidx.test.espresso:espresso-core:3.2.0'
testImplementation 'androidx.test.espresso:espresso-intents:3.2.0'

androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.2.0'
androidTestImplementation 'androidx.test.ext:truth:1.2.0'
  1. app/build.gradle里添加
android {
   // 引入robolectric库时需要添加的
    testOptions {
        unitTests {
            includeAndroidResources = true
        }
    }
}

About

AndroidX test demo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages