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. OpenCV入门学习笔记

    OpenCV入门学习笔记 参照OpenCV中文论坛相关文档(http://www.opencv.org.cn/) 一.简介 OpenCV(Open Source Computer Vision),开源 ...

  2. C#下实现软件欢迎界面

    找到几种简约的欢迎界面的制作方法,存此记录. 方法一:双线程,用第二个线程启动欢迎界面 原文:http://www.cnblogs.com/xiaoshatian/archive/2010/09/07 ...

  3. 【STL源码学习】STL算法学习之三

    第一章:前言 数量不多,用到的时候会很爽. 第二章:明细 STL算法中的又一个分类:分割:将已有元素按照既定规则分割成两部分.  is_partitioned 函数原型: template <c ...

  4. ABAP ALV 颜色设置(行,列,单元格)

    BCALV_EDIT_03 http://blog.sina.com.cn/s/blog_a87b19300102who3.html 关于ALV表格颜色,这种需求在项目中会经常用到. 列颜色 列的颜色 ...

  5. UITextView光标在中间的问题

    if ([self respondsToSelector:@selector(setAutomaticallyAdjustsScrollViewInsets:)]) { self.automatica ...

  6. Hibernate级联操作 注解

    EJB3 支持的操作类型 /** * Cascade types (can override default EJB3 cascades */ public enum CascadeType { AL ...

  7. 细说Java多线程之内存可见性

    编程这些实践的知识技能,每一次学习使用可能都会有新的认识 一.细说Java多线程之内存可见性(数据挣用)         1.共享变量在线程间的可见性                共享变量:如果一个 ...

  8. [Effective C++ --024]若所有参数皆需类型转换,请为此采用non-member函数

    引言 假设我们有这样的类: class A{ public: A(, ) {}; int num() const; int den() const; const A operator* (const ...

  9. java专业规划(转载)

    1. Java语言基础     谈到Java语言基础学习的书籍,大家肯定会推荐Bruce Eckel的<Thinking in Java>.它是一本写的相当深刻的技术书籍,Java语言基础 ...

  10. Maven项目中如何添加日志