软件测试-白盒测试

题目1

流程图

判定覆盖

需要三条路径

第一组:

  • (x,y,z) = (4,0,9)
  • (x,y,z) = (4,0,0)
  • (x,y,z) = (2,0,0)

第二组:

  • (x,y,z) = (4,0,9)
  • (x,y,z) = (4,0,0)
  • (x,y,z) = (1,0,0)

条件组合覆盖

第一个判断 第二个判断
x>3 z<10 x==4 y>5
x<=3 z<10 x!=4 y>5
x>3 z>=10 x==4 y<=5
x<=3 z>=10 x!=4 y<=5
所以4个组合
  • (x,y,z)=(4,6,9)
  • (x,y,z)=(3,6,9)
  • (x,y,z)=(4,5,10)
  • (x,y,z)=(3,5,10)

流程图

点覆盖

0,1,2,3,4,5,6
0,1,2,3,4,8,4
0,1,2,7,2,3,4,5,7
0,1,2,7,2,3,4,8,4,5,6
7,2,7
8,4,8

边覆盖

(0,1),(1,2),(2,3),(3,4),(4,5),(5,6),(2,7),(7,2),(4,8),(8,2)

边对覆盖

(0,1,2),(1,2,3),(1,2,7),(2,3,4),(2,7,2),(3,4,5),(3,4,8),(4,5,6),(4,8,4)

主路径覆盖

0,1,2,3,4,5,6