我克隆了一个存储库并尝试运行测试。不幸的是,JUnit 4无法识别我手动添加的目录
在尝试加载测试后,测试GUI会说:
找不到测试。
测试完成。
空的测试套件。
这是我的目录ExampleUnitTest
,我通过另一个项目复制了该目录(这是一个默认文件,没有问题,这是行不通的)
这是我的build.gradle
:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
testApplicationId "com.commonsware.android.retrofit.test"
}
}
dependencies {
compile 'com.squareup.retrofit:retrofit:1.6.1'
compile 'de.greenrobot:eventbus:2.2.1'
testCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test:rules:0.4.1'
}
在此按要求编辑ExampleUnitTest和运行/调试配置的内容。
package com.commonsware.android.retrofit;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句