1.测试的相关概念
  1、根据是否知道源代码分类:

黑盒测试: a - b - c  边值测试
    白盒测试: 根据源代码写测试方法 或者 测试用例;

2、根据测试的粒度分类:

方法测试:写完一个方法后就测试
    单元测试:测试一个能够独立运行的业务逻辑单元;
    集成测试:整体测试项目 联调
    系统测试:对整个系统进行测试

3、根据测试的暴力程度:

1、冒烟测试:高频次的点击软件
    2、压力测试:使用测试工具:LoadRunner、Jmeter

#2.单元测试

Junit

01_Junit单元测试 does not specify a android.test.InstrumentationTestRunner instrumentation or does not declare uses-library android.test.runner in its AndroidManifest.xml

单元测试的步骤:

1、写一个业务类,写一个业务方法:

public class CalcService {
   
    public static int add(int x,int y){
       
        return x+y;
    }

}

2、写一个测试类,写一个测试方法,用来测试业务方法

public class CalcServiceTest extends AndroidTestCase{
   
    public void testAdd(){
        int result = CalcService.add(4, 5);
        assertEquals(9, result);
        }
   
    }
3、在清单文件中添加测试需要的包
   
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.itheima.junit"
    android:versionCode="1"
    android:versionName="1.0" >

<!-- 添加指令集,添加到manifest节点的里面,指令集会把应用程序部署到模拟器上运行 -->

<instrumentation android:name="android.test.InstrumentationTestRunner" android:targetPackage="com.itheima.junit"></instrumentation>

<application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

<!-- 添加JUnit的测试包 ,添加到application节点的里面-->

<uses-library android:name="android.test.runner"/>
       
        ....
    </application>

</manifest>

1.测试的相关概念
1、根据是否知道源代码分类:

黑盒测试: a - b - c  边值测试
白盒测试: 根据源代码写测试方法 或者 测试用例;

2、根据测试的粒度分类:

方法测试:写完一个方法后就测试
单元测试:测试一个能够独立运行的业务逻辑单元;
集成测试:整体测试项目 联调
系统测试:对整个系统进行测试

3、根据测试的暴力程度:

1、冒烟测试:高频次的点击软件
2、压力测试:使用测试工具:LoadRunner、Jmeter

#2.单元测试

Junit

01_Junit单元测试 does not specify a android.test.InstrumentationTestRunner instrumentation or does not declare uses-library android.test.runner in its AndroidManifest.xml

单元测试的步骤:

1、写一个业务类,写一个业务方法:

public class CalcService {

public static int add(int x,int y){

	return x+y;
}

}

2、写一个测试类,写一个测试方法,用来测试业务方法

public class CalcServiceTest extends AndroidTestCase{

public void testAdd(){
int result = CalcService.add(4, 5);
assertEquals(9, result);
} }

3、在清单文件中添加测试需要的包

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.itheima.junit"
android:versionCode="1"
android:versionName="1.0" > <!-- 添加指令集,添加到manifest节点的里面,指令集会把应用程序部署到模拟器上运行 --> <instrumentation android:name="android.test.InstrumentationTestRunner" android:targetPackage="com.itheima.junit"></instrumentation> <application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" > <!-- 添加JUnit的测试包 ,添加到application节点的里面--> <uses-library android:name="android.test.runner"/> ....
</application> </manifest>

android测试的相关概念以及单元测试的更多相关文章

  1. [android] 测试的相关概念

    /********************2016年5月4日 更新********************************/ 知乎:如何专业地进行黑盒测试? 之前遇到过有些黑盒测试人员,感觉他 ...

  2. Android测试(四):Instrumented 单元测试

    原文:https://developer.android.com/training/testing/unit-testing/instrumented-unit-tests.html Instrume ...

  3. Android测试:从零开始2——local单元测试

    上一篇分析了android项目的测试分类,这一篇讲local单元测试. 参考android官方文档. 测试前需要配置测试环境,新建项目后,目录下会出现app/src/test/java/文件夹,这个文 ...

  4. Android studio下gradle Robolectric单元测试配置

    android studio下gradle Robolectric单元测试配置 1.Robolectric Robolectric是一个基于junit之上的单元测试框架.它并不依赖于Android提供 ...

  5. 【Android测试】【第十五节】Instrumentation——官方译文

    ◆版权声明:本文出自胖喵~的博客,转载必须注明出处. 转载请注明出处:http://www.cnblogs.com/by-dream/p/5482207.html 前言 前面介绍了不少Android ...

  6. 【Android测试】【第十一节】Uiautomator——简介

    ◆版权声明:本文出自胖喵~的博客,转载必须注明出处. 转载请注明出处:http://www.cnblogs.com/by-dream/p/4872244.html 前言 在App的测试中,除了单元测试 ...

  7. 【Android测试】【第九节】MonkeyRunner—— 初识

    ◆版权声明:本文出自胖喵~的博客,转载必须注明出处. 转载请注明出处:http://www.cnblogs.com/by-dream/p/4836815.html 不得不说两句,过了这么久才再次更新博 ...

  8. Android测试分析3

    一个基本的测试用例-- 如果是在eclipse中开发,那么需要在AndroidManifest.xml中加入如下两段代码:    <uses-library android:name=" ...

  9. 转:Android 测试 Appium、Robotium、monkey等框架或者工具对比

    原文地址:http://demo.netfoucs.com/u012565107/article/details/36419297# 1. Appium测试 (功能测试,用户接受度测试,黑盒测试) - ...

随机推荐

  1. git 几款好用的客户端工具

    虽然git命令非常好用,但客户端UI工具掌握起来.使用起来更加容易.如果你不想用git命令的话,那就用UI工具代替吧. 下面介绍下几款好用的git工具 1.tortoiseGit for Mac (这 ...

  2. 如何让OpenSSL得到JKS格式的keystore中的public and private key

    国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html内部邀请码:C8E245J (不写邀请码,没有现金送)国内私 ...

  3. linux设置tomcat开机自动启动

    1.修改/etc/rc.d/rc.local,使用vi /etc/rc.d/rc.local 命令2.在/etc/rc.d/rc.local文件最后添加下面两行脚本 export JAVA_HOME= ...

  4. DHCP Option 60 的理解

    原文地址: http://blog.163.com/chenqioulin_1983/blog/static/83216232010109104430251/   首先还是看看RFC咋说的吧.DHCP ...

  5. php中用户自定义排序

    php中数组用户自定义排序函数有usort和uasort,前者键值重新排列,后者保持原数组的键值. 举例usrot: usort($filterArr, 'sortArr'); function so ...

  6. mysql之sql语句细节问题汇总

    一.mysql count distinct null 使用注意事项 1  用一个例子来讲解一个问题,现在又一个库表hello,表内容如下: id     name 1      Null 2     ...

  7. android平台获取手机IMSI,IMEI ,序列号,和 手机号的方法

    1)获取运营商sim卡imsi号, String IMSI =android.os.SystemProperties.get( android.telephony.TelephonyPropertie ...

  8. C# 之 AES加密源码

    using System; using System.Collections.Generic; using System.Linq; using System.Web; using Exam.Encr ...

  9. swift项目中嵌入oc

    参考资料 需要注意的是  与oc包含swift不同的是  swift包含oc需要在桥接文件中包含要使用的oc的头文件 demo:swiftPlayOc(提取码:37c6)

  10. sed示例

    引用:http://www.cnblogs.com/ggjucheng/archive/2013/01/13/2856901.html [root@www ~]# sed [-nefr] [动作] 选 ...