android下的单元测试
来源:互联网 发布:老滚5原版捏脸数据 编辑:程序博客网 时间:2024/05/01 05:02
被测试类
package com.example.test; public class ToolTest { publicstatic int test(int a, int b) { returna + b; }}
使用测试类AndroidTestCase
package com.example.test; import android.test.AndroidTestCase; public class MyAndroidTest extends AndroidTestCase { publicvoid test(){ intresualt = ToolTest.test(4, 9); //被测试的工具类 assertEquals(11, resualt); }}
<?xml version="1.0"encoding="utf-8"?><manifestxmlns:android="http://schemas.android.com/apk/res/android" package="com.example.test" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17" /> <!--注意instrumentation位置,targetPackage路径为要测试的的方法所在的包名--> <instrumentation android:name="android.test.InstrumentationTestRunner" android:targetPackage="com.example.test" ></instrumentation> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <!--注意uses-library位置--> <uses-libraryandroid:name="android.test.runner"/> <activity android:name="com.example.test.MainActivity" android:label="@string/app_name" > <intent-filter> <actionandroid:name="android.intent.action.MAIN" /> <categoryandroid:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
0 0
- android 下的单元测试
- android下的单元测试:
- Android下的单元测试
- Android下的单元测试
- android下的单元测试
- Android下的junit单元测试
- Android下的junit 单元测试
- Android下的Junit单元测试
- Android Studio下的单元测试
- Android Studio下的单元测试
- Android下进行单元测试
- android下单元测试
- Android下单元测试
- Android下进行单元测试
- 主题:Android-Junit-TestCase-ClassLoader 讨论下Android的单元测试
- Android-Junit-TestCase-ClassLoader 讨论下Android的单元测试
- xcode下的单元测试
- Spring下的单元测试
- 微信支付生成签名
- 安全认证https服务器的搭建
- Filter、Servlet和Listener区别与联系
- 第十四周实践之成绩处理函数版
- 提取文章高频词
- android下的单元测试
- java中equals和==的区别
- Java中使用Jedis操作Redis
- 关于mybatis只能查询英文,不能查询中文的问题
- SpringMVC 过滤器Filter使用解析
- 网络爬虫
- Android 内存泄漏(一)
- 16 - 12 - 06 克鲁斯卡尔(Kruskal)算法详解
- c#可空类型(Nullable)