android测试的相关概念以及单元测试
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测试的相关概念以及单元测试的更多相关文章
- [android] 测试的相关概念
/********************2016年5月4日 更新********************************/ 知乎:如何专业地进行黑盒测试? 之前遇到过有些黑盒测试人员,感觉他 ...
- Android测试(四):Instrumented 单元测试
原文:https://developer.android.com/training/testing/unit-testing/instrumented-unit-tests.html Instrume ...
- Android测试:从零开始2——local单元测试
上一篇分析了android项目的测试分类,这一篇讲local单元测试. 参考android官方文档. 测试前需要配置测试环境,新建项目后,目录下会出现app/src/test/java/文件夹,这个文 ...
- Android studio下gradle Robolectric单元测试配置
android studio下gradle Robolectric单元测试配置 1.Robolectric Robolectric是一个基于junit之上的单元测试框架.它并不依赖于Android提供 ...
- 【Android测试】【第十五节】Instrumentation——官方译文
◆版权声明:本文出自胖喵~的博客,转载必须注明出处. 转载请注明出处:http://www.cnblogs.com/by-dream/p/5482207.html 前言 前面介绍了不少Android ...
- 【Android测试】【第十一节】Uiautomator——简介
◆版权声明:本文出自胖喵~的博客,转载必须注明出处. 转载请注明出处:http://www.cnblogs.com/by-dream/p/4872244.html 前言 在App的测试中,除了单元测试 ...
- 【Android测试】【第九节】MonkeyRunner—— 初识
◆版权声明:本文出自胖喵~的博客,转载必须注明出处. 转载请注明出处:http://www.cnblogs.com/by-dream/p/4836815.html 不得不说两句,过了这么久才再次更新博 ...
- Android测试分析3
一个基本的测试用例-- 如果是在eclipse中开发,那么需要在AndroidManifest.xml中加入如下两段代码: <uses-library android:name=" ...
- 转:Android 测试 Appium、Robotium、monkey等框架或者工具对比
原文地址:http://demo.netfoucs.com/u012565107/article/details/36419297# 1. Appium测试 (功能测试,用户接受度测试,黑盒测试) - ...
随机推荐
- 获取客户端Ip地址方法
public static string GetIp() { string ip; HttpRequest request = HttpContext.Current.Request; if (req ...
- jquery如何自定义插件(扩展实例/静态方法)
1.jquery插件的种类: 1).封装对象方法的插件(相当于实例方法) (使用 $.fn.extend({"方法名":function(参数){//方法体} }) ) 2).封装 ...
- C++学习笔记(九):作用域和命名空间
作用域 作用域规则告诉我们一个变量的有效范围,它在哪儿创建,在哪儿销毁(也就是说超出了作用域).变量的有效作用域从它的定义点开始,到和定义变量之前最邻近的开括号配对的第一个闭括号.也就是说,作用域由变 ...
- 实例:ABAP Tree Control 使用与ALV Grid对象关联
Tree Control 是最常用的Windows控件之一,在其他语言中成为"Tree View"等,ABAP的 Tree Contiol 能实现类似的功能. 本文主要介绍一下内容 ...
- linux集群时间同步
说明:由于hadoop集群对时间要求很高,所以集群内主机要经常同步.本文档适合ubuntu.redhat系列. 注:很多内容是在网上摘录,然后试验后总结,如有疑问可留言探讨. 1.设置主机时间准确(任 ...
- iOS开发——Swift篇&Swift关键字详细介绍
Swift关键字详细介绍 每一种语言都有相应的关键词,每个关键词都有他独特的作用,来看看swfit中的关键词: 关键词: 用来声明的: “ class, deinit, enum, extension ...
- careercup-排序和查找 11.7
11.7 有个马戏团正在设计叠罗汉的表演节目,一个人要站在另一人的肩膀上.处于实际和美观的考虑,在上面的人要比下面的人矮一点.轻一点.已知马戏团每个人的高度和重量,请编写代码计算叠罗汉最多能叠几个人. ...
- com.ulitis.www
package com.ulitis.www; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io ...
- java_jdbc_反射
package cn.itcast.Reflect; import java.lang.reflect.Constructor; import java.lang.reflect.Field; imp ...
- Joseph cicyle's algorithm
约瑟夫环问题: 输入:1)总共人数:2)每次被杀的序号数: 输出:最后一个活着的序号 python代码如下: n=int (input('please input the number of peop ...