Junit白盒测试测试用例.doc
文本预览下载声明
软件测试报告
目 录
一、简介 2
1.1、编写目的 2
1.2、测试范围 2
二、测试资源 2
2.1、人力资源 2
2.2、测试环境 2
2.3、测试工具 3
三、测试 3
3.1、greatCircleDistance ()函数 3
3.2、compareBytes()函数 3
3.3、getHue ()函数 3
3.4、arraycopy ()函数 3
3.5、computeIntersection ()函数 3
四、遇到的困难及解决方法 3
一、简介
1.1、编写目的
使用等价类划分方法对于所选的五个功能模块进行测试,并使用Junit方法设计测试用例。
1.2、测试范围
使用等价类划分方法对于所选的五个功能模块进行测试,并使用Junit方法设计测试用例。
二、测试资源
2.1、人力资源
姓名 角色 具体职责和注释 夏玉娜 方案设计人、测试技术设计人 策划总体规模,测试内容,规划测试方案;测试并记录测试情况。 赵秀秀 测试人、记录人、文档整理人 制定测试方案,确定测试深度,测试技术设计;测试并记录测试情况,编写软件测试报告。 陈玉霞 检查人员 检查所写文档,有需要进行修改 2.2、测试环境
下表列出了测试的系统环境
机器环境 工作计算机 软件环境
(相关软件、操作系统等) Windows XP SP3
jdk1.6.0_06
Eclipse Platform Version: 3.3.3 硬件环境
(设备、网络等) 笔记本电脑 2.3、测试工具
用途 工具名称 生产厂商 版本 单元测试 JUNIT JUnit.org 4.7/3.8 三、测试
3.1、greatCircleDistance ()函数
greatCircleDistance ()方法计算球面距离,输入的分别为两个点的经度和纬度以及球的半径,以下为其源码:
public static double greatCircleDistance(double latitudeS,
double longitudeS, double latitudeF, double longitudeF, double r)
{
if (latitudeS = -90 || latitudeS = 90 ||
latitudeF = -90 || latitudeF = 90 ||
longitudeS = -180 || longitudeS = 180 ||
longitudeF = -180 || longitudeF = 180 || r 0) {
throw new IllegalArgumentException();
}
latitudeS = Math.toRadians(latitudeS);
latitudeF = Math.toRadians(latitudeF);
longitudeS = Math.toRadians(longitudeS);
longitudeF = Math.toRadians(longitudeF);
double deltaLongitude = longitudeF - longitudeS;
double a = Math.cos(latitudeF) * Math.sin(deltaLongitude);
double b = Math.cos(latitudeS) * Math.sin(latitudeF);
b -= Math.sin(latitudeS) * Math.cos(latitudeF)
* Math.cos(deltaLongitude);
double c = Math.sin(latitudeS) * Math.sin(latitudeF);
c += Math.cos(latitudeS) * Math.cos(latitudeF)
* Math.cos(deltaLongitude);
if (c 0)
c = -c;
return Math.atan(Math.sqrt(a * a + b * b) / c) * r;
}
针对此函数我们运用了等价类划分的方法生成JUnit测试用例总共划分出25个用例,等价类分别是:
对latitudeS划分:-90到0,0到90以及不合法输入;
对longitudeS划分:-180到0,0到180以及不合法输入;
对latitudeF划分:-90到0,0到90以及不合法输入;
对longitudeF划分:-180到0,0到180以及不合法输入;
对半径r的划分:大于0以及不合法的输入;
以下为具体
显示全部