如果在android项目中试用Jnit做测试
来源:互联网 发布:js截取小数点后两位 编辑:程序博客网 时间:2024/05/17 01:52
接到一个任务进行Jnit对项目进行测试,总结了步骤如下:
在eclipse里右键新建project,然后选择:
然后:
点击next:
最后点击finish,就可以建立一个jnit的项目(叫做项目T)了,这个项目可以调用你要测试的项目(叫做项目A)的任何class文件
也可以访问A的数据库
我们可以看到这个jnit的项目的menifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ringcentral.android.test"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="14" />
<instrumentation
android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.ringcentral.android" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<uses-library android:name="android.test.runner" />
<activity
android:name="com.ringcentral.android.test.testGetMobileUri"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
然后在T中新建一个java文件,要继承AndroidTestCase
然后override runtest方法,如下:
@Override
protected void runTest() throws Throwable {
//write your test content here,you can access your database,and call any java class in A
final long mailboxId = RCMProviderHelper.getCurrentMailboxId(getContext());
restAuthorization(getContext());
RestConference.updateConferenceInfo(mailboxId);
// updateGetMobileWebLinkInfo(mailboxId);
super.runTest();
}
run的时候右键项目T,点击Run as Android Jnit test就可以了,你可以在控制台打印你的log,就可以看到项目A的一些功能是否符合你的要求
- 如果在android项目中试用Jnit做测试
- 如何在android项目中试用FontAwesome
- 如果做项目总结
- 在myeclipse中项目名中如果有下划线在测试时url地址应该取下划线以后的字段
- 在MTK项目中试用分布式编译系统IncrediBuild
- 在MTK项目中试用分布式编译系统IncrediBuild
- 在MTK项目中试用分布式编译系统IncrediBuild
- android在项目中如果只需要一种cpu架构的处理方法
- 如果在魔兽世界中,做一个合格野性德
- 如果在android中应用activemq
- 如果在android中应用activemq
- android NDK开发中 在native代码试用log
- 领域专家在项目中做作用
- android studio中做断点测试
- Android中如何做Monkey测试
- 移动端项目如何在手机上面做测试
- 如果我来做项目管理
- android中如果在手机显示logo不清楚的问题
- 《爱和自由》——孩子达到顺从的三个阶段
- pb match的问题
- xampp mysql 优化最好心得
- 《C专家编程》学习笔记(分析C语言的声明)
- 实时大单[博客]名博:五月买两种股最赚钱锤
- 如果在android项目中试用Jnit做测试
- PWM(脉宽调制)的基本原理及其应用实例
- C++模板学习3
- 創建同義詞
- .bash_profile和.bashrc的区别(如何设置生效)
- android 视频通话相关
- 使用ajax请求servlet返回json格式字符串
- C# 串口通信相在资料链接(转贴) .
- Basin hopping是什么全局优化算法?