Android的ES preSSO错误没有发现测试 [英] Android espresso error no tests found
本文介绍了Android的ES preSSO错误没有发现测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试使用长者preSSO测试框架来测试我的应用程序。
I try to use Espresso test framework for testing my app.
ENV:
Android的工作室RC1(从金丝雀)
最新的Android摇篮插件,0.14 +
Android Studio RC1 (from canary) Latest Android Gradle plugin, 0.14+
我说这里所描述(的 HTTPS://$c$c.google.com/p/android-test-kit/wiki/Es$p$psso#Getting_Started )
dependencies {
//espresso - test framework
androidTestCompile files('libs/espresso-1.1.jar',
'libs/testrunner-1.1.jar',
'libs/testrunner-runtime-1.1.jar')
androidTestCompile 'com.google.guava:guava:14.0.1',
'com.squareup.dagger:dagger:1.1.0',
'org.hamcrest:hamcrest-core:1.1',
'org.hamcrest:hamcrest-integration:1.1',
'org.hamcrest:hamcrest-library:1.1'
}
packagingOptions {
exclude 'LICENSE.txt'
}
defaultConfig {
//espresso - test framework
testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
}
此外,我创建了简单的测试:
Also I created simple test:
public class StartActivityTest extends ActivityInstrumentationTestCase2<StartActivity> {
public StartActivityTest(Class<StartActivity> activityClass) {
super(activityClass);
}
@Override
public void setUp() throws Exception {
super.setUp();
// Espresso will not launch our activity for us, we must launch it via getActivity().
getActivity();
}
public void testStartVisibility() {
onView(withId(R.id.app_title))
.check(matches(isDisplayed()));
onView(withId(R.id.app_thumb))
.check(matches(isDisplayed()));
onView(withId(R.id.label))
.check(matches(isDisplayed())
);
onView(withId(R.id.label)).check(matches(withText("Hello Espresso!")));
}
}
但我得到一个错误:
But i get an error:
com.android.builder.testing.ConnectedDevice > hasTests[Nexus 5 - 5.0] FAILED
No tests found.
:app:connectedAndroidTest FAILED
FAILURE: Build failed with an exception.
推荐答案
好吧,我知道了。
我有如下使用默认的构造函数:
I have to use default constructor as below:
public StartActivityTest() {
super(StartActivity.class);
}
这是固定的问题。
这篇关于Android的ES preSSO错误没有发现测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文