我注解班里喜欢这里AndroidJUnit4测试没有发现
@RunWith(AndroidJUnit4.class)
public class WorkdayProviderTest
Futhermore,也注释这样
@Test
public void insert_dataInsertsCorrectly()
我的测试方法。最后,配置了我的build.gradle defaultConfig和依赖这样
defaultConfig {
applicationId 'com.jueggs.workinghours'
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
androidTestCompile "junit:junit:4.12"
androidTestCompile "com.android.support:support-annotations:23.3.0"
androidTestCompile "com.android.support.test:runner:0.4.1"
androidTestCompile "com.android.support.test:rules:0.4.1"
androidTestCompile "com.android.support.test.espresso:espresso-core:2.2.1"
androidTestCompile "com.android.support.test.espresso:espresso-contrib:2.2.1"
androidTestCompile "org.hamcrest:hamcrest-library:1.3"
并配置了这样的测试运行
和it's告诉我
No tests were found
Test running failed: Instrumentation run failed due to 'java.lang.ClassNotFoundException'
如何解决这个问题?
是我有这个依赖关系,查看更新 – Lemao1981
删除'@RunWith(AndroidJUnit4.class)'并运行test。你也可以用'@RunWith(JUnit4.class)'改变'@RunWith(AndroidJUnit4.class)',它应该运行。 – piotrek1543
没有解决问题,在两种情况下都找不到任何测试。在0.4.1版本中,类AndroidJUnit4存在 – Lemao1981