引用地址:

​http://www.jianshu.com/p/de17655125f5​

1.按着步骤需要注意的地方:junit-4.12.jar 需要使用

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile ('com.android.support:appcompat-v7:22.1.1'){
exclude group: 'com.android.support', module:'support-annotations'
}
//上面的含义是 去除 v7 包中的 annotations 包

testCompile 'junit:junit:4.12' //需要使用外部,

androidTestCompile 'com.android.support.test:runner:0.2'
androidTestCompile 'com.android.support.test:rules:0.2'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.1'

}

自己从其他地方下载的,会报 ClassNotfound 异常,具体要因可能是 下载下来的版本较旧导致~~

包含 单元测试和 ui测试 demo ,ui测试自己写用例有点多余。暂时没有使用