Test run failed: Test run failed to complete. Expected 1 tests, received 0
来源:互联网 发布:安康软件开发公司 编辑:程序博客网 时间:2024/05/19 09:09
这个问题有几天了
我的错误在于这个函数带参数了,去掉参数就好了
错误代码
public void TestChange(String newName, String newPhone, String oldName)
throws Exception
{
insertDeleteChangeCheck = new InsertDeleteChangeCheck(getContext(),
"yangming.db", null, 2);
insertDeleteChangeCheck.change("yangming", "123yanging", "test--17");
}
正确代码
public void TestChange() throws Exception
{
insertDeleteChangeCheck = new InsertDeleteChangeCheck(getContext(),
"yangming.db", null, 2);
insertDeleteChangeCheck.change("yangming", "123yanging", "test--17");
}
-------------------------------------------------------------------------------------------------http://blog.csdn.net/henry121212/article/details/7834856
今天在写弄一个单元测试的时候老是报 Test run failed: Test run failed to complete. Expected 1 tests, received 0错误,我在google中查了很多资料,有的说是得有一个空构造函数,我也这么做了,可是依然没有效果,
我一一检查是不是自己没有功能配置文件中加入:
<instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="你的单元测试所在包名" android:label="Tests for My App" />,和<uses-library android:name="android.test.runner" />,自己也加入了,可就是产行,
因为我个人习惯,我把那个单元测试方法写了private权限,我一直以为这样写应该没有什么问题,在我几乎想不到是哪里有错时,我试着把那个单元测试方法的private权限改了public权限,运行一看,好了,原来问题就在这个单元测试方法不能为private权限,一定写成public权限,要不就会报Test run failed: Test run failed to complete. Expected 1 tests, received 0错误,
下面 我简单的总结一下android单元测试的一些要求吧,
1。你要实现单元测试的类必须得继承AndroidTestCast类,
2,你单元测试中的那个方法必须以Test开头:Test+你的方法名,
3,你运行这个单元测试类的方法,一定选中这个以Test开头的方法,再单击右键,选中Android JUnit Test方可,
4,在你的项目的功能配置文件中必须加入 <instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="你的单元测试所在包名" android:label="Tests for My App" />,这一行加在<application>节点外面,而<uses-library android:name="android.test.runner" />则要加在<application>里面,组件节点外面,如<Activity>节点外面,
5,你单元测试中的那个方法必须抛出异常 ,在你的方法加上:throws throwable
- android 单元测试Test run failed: Test run failed to complete. Expected 1 tests, received 0
- Test run failed: Test run failed to complete. Expected 1 tests, received 0错误
- android 单元测试Test run failed: Test run failed to complete. Expected 1 tests, received 0
- Test run failed: Test run failed to complete. Expected 1 tests, received 0
- Robotium自动化测试:Test run failed to complete. Expected 1 tests, received 0
- 【android初学日志】Test run failed: Test run incomplete. Expected 1 tests, received 0<二>
- Test run failed: Instrumentation run failed due to 'Process crashed.'
- Android问题:Test run failed: Instrumentation run failed due to 'java.lang.RuntimeException'
- Test run failed: Instrumentation run failed due to 'java.lang.ClassNotFoundException'
- Test run failed: Instrumentation run failed due to 'java.lang.ClassNotFoundException'
- Test run failed: Instrumentation run failed due to 'Process crashed.'解析
- Test run failed:Unable to find instrumentation target package
- android单元测试Test run failed: Unable to find instrumentation target package: com.abc.wallpaper.test
- 解决Test running failed: Instrumentation run failed due to 'java.lang.IncompatibleClassChangeError'
- Android异常总结---Test run failed:Unable to find instrumentation target package
- 安卓单元测试错误Test run failed: Unable to find instrumentation target package解决办法
- Android单元测试Test run failed: Unable to find instrumentation target package
- 【转】Andriod 单元测试 Test run failed:Unable to find instrumentation target package的问题
- (javaweb读书笔记系列之三)request和response
- 迷你型无线USB网卡 TL-WN823N linux系统安装驱动usb
- ibatis简单搭建与操作
- xcode6添加MKNetworkKit的步骤说明
- 强大的Java前台后台开发工具
- Test run failed: Test run failed to complete. Expected 1 tests, received 0
- H.264中NAL、Slice与frame意思及相互关系
- shell脚本练习题
- Eclipse调试出现value optimized out的解决方法
- XML 及相关技术规范
- 新sdk(5.0+)eclipse建android工程报错
- Android的Camera架构介绍
- 对shell脚本Ctrl+C导致被脚本启动的进程全部中断退出
- mac 10.9.4编译protobuf