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. 空循环比较 for foreach array_map array_walk

    申请一个数组,然后不断的跑空循环,看看执行时间 for循环 foreach (不使用键) foreach(使用键) array_map array_walk 查看效率速度发现很明显 是foreach更 ...

  2. MFC版美女找茬

    今天心情:捡了个闲暇. 前几天工作出了个漏洞,电话会议时候怎么都是忽大忽小的声音,实在没听清电话会议的内容,完了依据想象交了一个设计方案,之后便是赋闲. 进入正题,美女找茬实现不难,没有设计上的难度, ...

  3. SQLite DBHelp

    c#连接SQLite SQLite这个精巧的小数据库,无需安装软件,只需要一个System.Data.SQLite.DLL文件即可操作SQLite数据库.SQLite是一个开源数据库,现在已变得越来越 ...

  4. jquery 延迟加载代码

    <!--引入以下两个js文件--> <script type="text/javascript" src="./js/jquery.min.js&quo ...

  5. git 回退和删除操作

    今天不小心把分支的commit提交到master上了.衰 主要通过下面几个命令解决了,很简单记录一下. git reset –hard  回退到某一个版本git push origin :xxxx  ...

  6. [置顶] ORACLE分析函数(1)

    分析函数式ORACLE提供的用来进行数据统计的强有力工具,与我们常用的聚合函数具有一些相似性,但又完全不同.聚合函数,首先会将数据进行分组,然后对每一组数据进行运算,如求和sum,求平均AVG等,对于 ...

  7. jquery美化滚动条插件jscrollpane应用(转)

    原文地址:http://www.jqcool.net/jquery-jscrollpane.html jScrollPane是一个设计非常灵活的跨浏览器的jQuery ,它将浏览器的默认滚动条或是元素 ...

  8. MySQL如何选择float, double, decimal

    http://yongxiong.leanote.com/post/mysql_float_double_decimal

  9. 阿里封神谈hadoop学习之路

    阿里封神谈hadoop学习之路   封神 2016-04-14 16:03:51 浏览3283 评论3 发表于: 阿里云E-MapReduce >> 开源大数据周刊 hadoop 学生 s ...

  10. Ⅰ.Spring的点点滴滴--序章

    spring是一个轻量级的控制反转(IoC)和面向切面(AOP)的容器框架 .net篇(环境为vs2012+Spring.Core.dll) 新建一个控制台 using Spring.Context; ...