在module的build.gradle添加依赖
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
- __androidTest/java__运行在jvm上的单元测试,需要连接安卓设备
- __test/java__是Junit单元测试,不需要Android依赖的单元测试类,速度快,适合对java代码功能进行单元测试
添加单元测试类
来源:CSDN
作者:why123wh
链接:https://blog.csdn.net/why123wh/article/details/104136049