三角形白盒测试文档格式.docx
- 文档编号:22094639
- 上传时间:2023-02-02
- 格式:DOCX
- 页数:47
- 大小:98.57KB
三角形白盒测试文档格式.docx
《三角形白盒测试文档格式.docx》由会员分享,可在线阅读,更多相关《三角形白盒测试文档格式.docx(47页珍藏版)》请在冰豆网上搜索。
25elseif(sign1==1&
sign2==0)
26System.out.print("
是等腰三角形"
27elseSystem.out.print("
是一般三角形"
}
}
28elseSystem.out.print("
notaTriangle"
}
29elseSystem.out.print("
inputiserror!
30.}
DD路径图:
程序中节点
DD路径名称
7
开始
8-11
A
12
B
13
C
14
E
15
H
16
I
17-18
J
19
K
20
L
21
M
22
N
23
O
24
P
25
Q
26
R
27
S
28
F
29
D
30
结束
1.语句覆盖:
编号
a
b
c
覆盖语句
1
100
ABD
2
5
4
10
ABCF
3
`10
ABCEH
·
ABCEIJKLMN
ABCEIJKLMOP
6
ABCEIJKLMOQR
11
ABCEIJKLMOQS
条件
1:
a>
02:
03:
0
4:
a<
2005:
b<
2006:
200
7:
a+b>
c8:
b9:
10:
a=b11:
a=c12:
a=b
13:
b=c14:
a=c15:
a*a+b*b==c*c
16:
a*a==b*b+c*c17:
b*b==c*c+a*a
18:
sign1=119:
sign2=1
20:
sign1=021:
sign2=1
22:
sign1=123:
sign2=0
2.判定覆盖:
覆盖分支
F1
T(1-6)F7
T(1-11)
T(1-10)F11T12F13F14T15
T(1-9)F(10-14)T15
T(1-10)F11T12F13F14F15F16F17
T(1-9)F(10-17)T20
3.条件覆盖:
覆盖判定
T1F2
T1T2F3
201
T1T2T3F4
T1T2T3T4F5
T1T2T3T4T5F6
8
T(1-6)T7F8
9
T(1-6)T7T8F9
10
8
T(1-9)F10F(12-17)F18F19T20F21F22
T(1-9)T10F11T12F15F16F17T18F19F20T22F23
T(1-9)F10F11F12T13T18F19F20F21T22
T(1-9)F10F11F12F13T14T18F19F20F21T22T23
T(1-9)F(10-14)T15F17F18T19T20T21
T(1-9)F(10-17)F18F19T20F21F22F23
4.路径覆盖:
覆盖路径
5.条件判定覆盖:
T(1-9)T10F11T12F15F16F17T18F19F20T22F23
T(1-9)F(10-14)T15F17T20T21
T(1-10)F11T12F13F14F15F16F17T18F19F20T22T23
17
T(1-9)F(10-14)F15F15T17F18T19T20T21
18
T(1-9)F(10-14)F15T17F18T19T20T21
6.条件组合覆盖:
数据流测试
基路径:
圈复杂度:
6+1=7
变量
定义节点
使用节点
12141719
sign1
1118
212225
sign2
1120
a的定义使用路径
节点(起始,结束)
是否定义清楚
812
是
814
817
819
b的定义使用路径
912
914
917
919
c的定义使用路径
1012
1014
1017
1019
Sign1的定义使用路径
Sign1
1121
否
1122
1125
1821
1822
1825
Sign2的定义使用路径
Sign2
2021
2022
2025
下一天问题:
packagez;
importjava.util.Scanner;
importjavax.swing.JOptionPane;
publicclassNextDate
{
publicstaticvoidmain(String[]args)
{
inttomDay,tomMonth,tomYear;
intday,month,year;
System.out.println("
Entertoday'
sdateintheformMMDDYYYY"
Scannerinput=newScanner(System.in);
1month=input.nextInt();
2day=input.nextInt();
3year=input.nextInt();
4if(day<
1||day>
31||month<
1||month>
12||year<
1812||year>
2012)
5System.out.println("
输入错误"
6else
7switch(month)
8case1:
9case3:
10case5:
11case7:
12case8:
13case10:
14if(day<
31)
15tomDay=day+1;
16tomMonth=month;
17tomYear=year;
18System.out.println(month+"
:
+day+"
+year+"
的下一天是"
+tomMonth+"
+tomDay+"
+tomYear);
19else
20tomDay=1;
21tomMonth=month+1;
22tomYear=year;
23System.out.println(month+"
24break;
25case4:
26case6:
27case9:
28case11:
29if(day<
30)
30tomDay=day+1;
31tomMonth=month;
32tomYear=year;
33System.out.println(month+"
34elseif(day==30)
35tomDay=1;
36tomMonth=month+1;
37tomYear=year;
38System.out.println(month+"
39else
40System.out.println("
41break;
42case12:
43if(day<
44tomDay=day+1;
45tomMonth=month;
46tomYear=year;
47System.out.println(month+"
48else
49tomDay=1;
50tomMonth=1;
51tomYear=year+1;
52System.out.println(month+"
53break;
54case2:
55if(day<
28)
56tomDay=day+1;
57tomMonth=month;
58tomYear=year;
59System.out.println(month+"
60elseif(day==28)
61if((year%4==0&
year%100!
=0)||(year%400==0))
62tomDay=29;
63tomMonth=month;
64tomYear=year;
65System.out.println(month+"
66else
67tomDay=1;
68tomMonth=month+1;
69tomYear=year;
70System.out.println(month+"
71elseif(day==29)
72if((year%4==0&
73tomDay=1;
73.5tomMonth=month+1;
74tomYear=year;
74.5System.out.println(month+"
75else
76System.out.println("
77else
78System.out.println("
79break;
}
}
80}
程序中的节点
DD路径图节点
1-3
6-13
15-18
19-23
G
U
25-28
30-33
34
35-38
39-40
41
W
42
43
44-47
48-52
53
54
55
56-59
60
T
61
X
62-65
Z
66-70
X1
71
Y
72
X2
73-74
X4
75-76
X5
77-78
X3
79
X6
80
DD路径图
语句覆盖:
Month
Day
Year
预期输出
1991
输入错误
AB
1912
1311912
ACDFU
31
211912
ABCDGU
6161912
ACEHKV
711912
711912
ACEHLOV
ACEHLPV
12161912
ACEIMQW
111913
2171912
ACEIJNSX6
2008
2291912
ACEIJNTXZX6
2007
132007
ACEIJNTXX1X6
132008
ACEIJNTYX2X4X6
ACEIJNTYX2X5X6
ACEIJNTYX3X6
路径覆盖:
用例等同于语句覆盖
条件覆盖:
day<
12:
day>
313:
month<
14:
month>
125:
year<
18126:
year>
2012
month=18:
month=39:
month=510:
month=711:
month=812:
month=10
3114:
month=415:
month=616:
month=917:
month=1118:
3019:
day=3020:
month=1221:
3122:
month=223:
2824:
day=28
25:
year%4=026:
=027:
year%400=028:
day=2929:
year%4=0
30:
year%100!
=031:
year%400=0
覆盖条件
T1
F1T2
1919
F1F2T3
F1F2F3T4
1810
F1F2F3F4F5T6
2030
F(1-6)
F(1-6)T7T13
32
F(1-7)T8F13
F(1-8)T9T13
F(1-9)T10T13
F(1-10)T11T13
F(1-11)F14T18
F(1-11)F14T15F18T19
F(1-11)F14F15T16F18F19
F(1-11)F(14-16)T17T18
F(1-11)F(14-17)T20T21
F(1-11)F(14-17)T20F21
F(1-11)F(14-17)F20T22T23
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 三角形 测试
![提示](https://static.bdocx.com/images/bang_tan.gif)