黑盒测试:等价类划分法(弱健壮)

2022-06-23 12:57:01 浏览数 (1)

问题

构造下述三角形问题的弱健壮的等价类测试用例。

  • 三角形问题:输入三个不超过100的正整数作为三角形的三条边,判断三角形是等边三角形、等腰不等边三角形、完全不等边三角形还是不能构成三角形。

解答

有效等价类划分:

  • R1 = {<a, b, c>: the triangle with sides a, b, and c is equilateral}
  • R2 = {<a, b, c>: the triangle with sides a, b, and c is isosceles}
  • R3 = {<a, b, c>: the triangle with sides a, b, and c is scalene}
  • R4 = {<a, b, c>: sides a, b, and c do not form a triangle}

Test Case

a

b

c

Expected Output

WR1

5

5

5

Equilateral

WR2

2

2

3

Isosceles

WR3

3

4

5

Scalene

WR4

4

1

2

Not a triangle

WR5

-1

5

5

Value of a is out of range

WR6

5

-1

5

Value of b is out of range

WR7

5

5

-1

Value of c is out of range

WR8

101

5

5

Value of a is out of range

WR9

5

101

5

Value of b is out of range

WR10

5

5

101

Value of c is out of range

WR11

5.1

5

5

Value of a is not a integer

WR12

5

5.1

5

Value of b is not a integer

WR13

5

5

5.1

Value of c is not a integer

0 人点赞