测试运行失败:测试运行未能完成。预计1测试中,获得0 [英] Test run failed: Test run failed to complete. Expected 1 tests, received 0
本文介绍了测试运行失败:测试运行未能完成。预计1测试中,获得0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试使用我的应用程序启动JUnit测试(robotium)。
Try start JUnit test (robotium) for my app.
public class MainTest extends ActivityInstrumentationTestCase2<MainActivity> {
private Solo solo;
public MainTest() {
super("nix.android.contact", MainActivity.class);// TODO Auto-generated constructor stub
}
protected void setUp() throws Exception {
super.setUp();
solo = new Solo(getInstrumentation(), getActivity());
}
public void AddContact() {
solo.assertCurrentActivity("main", MainActivity.class);
}
}
清单
Manifest
<instrumentation
android:name="android.test.InstrumentationTestRunner"
android:targetPackage="nix.android.contact" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<uses-library android:name="android.test.runner" />
</application>
当我尝试运行测试,得到控制台:
When I try run test, get in console:
Test run failed: Test run failed to complete. Expected 1 tests, received 0
我尝试创建其他的测试为其他应用程序(非常简单的应用程序) - 的作品
I try create other test for other app (very simple app) - works.
感谢
推荐答案
我有这个问题时,我没有一个无参数的构造函数。
I had this problem when I didn't have a no-args constructor.
public class MainActivityTest extends
ActivityInstrumentationTestCase2<MainActivity_> {
public MainActivityTest() {
super(MainActivity_.class);
}
...
这篇关于测试运行失败:测试运行未能完成。预计1测试中,获得0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文