Software Testing (7)

Assignment 7.

Problem

Construct a weakly robust equivalence class test case for the following triangle problem.
Triangle problem: Enter three positive integers not exceeding 100 as the three sides of the triangle, and determine whether the triangle is an equilateral triangle, an isosceles scalene triangle, a complete scalene triangle, or not a triangle.

Divide equivalence classes

The three sides of the triangle are marked S = { a , b , c } S=\{a,b,c\}S={ a,b,c } , then the equivalence classes of weak robustness are divided as follows

(1) S ⊆ N ∗ S \subseteq \N^{*} SN

(2) S ⊆ Z − N ∗ S \subseteq \Z - \N^{*} SWITHN

(3) ∀ s ∈ S , s ∈ [ 1 , 100 ] \forall s \in S,s\in[1,100] sS,s[1,100]

(4) ∃ s ∈ S , s ∈ ( − ∞ , 1 ) ∪ ( 100 , + ∞ ) \exist s \in S, s \in (-\infty,1) \cup (100, +\infty) sS,s(,1)(100,+)

(5) a = b = c a=b=c a=b=c

(6) ∃   x 1 ∈ S ,   ∃ x 2 ∈ S − { x 1 } , x 3 ∈ S − { x 1 , x 2 } , ( x 1 ≠ x 3 ) ∧ ( x 1 = x 2 ) \exist \ x_1 \in S, \ \exist x_2 \in S-\{x_1\}, x_3 \in S-\{x_1, x_2\},(x_1 \neq x_3) \wedge (x_1=x_2) x 1S, x2S{ x1},x3S{ x1,x2},(x1̸=x3)(x1=x2)

(7) a ≠ b ≠ c a \neq b \neq c a̸=b̸=c

(8) ( a + b < = c ) ∨ ( a + c < = b ) ∨ ( b + c < = a ) (a+b<=c) \vee (a+c<=b) \vee (b+c<=a) (a+b<=c)(a+c<=b)(b+c<=a)

input condition Effective Equivalence Class invalid equivalence class
input as positive integer (1) (2)
Enter a value that does not exceed 100 (3) (1)
Equilateral triangle (5) (6),(7),(8)
isosceles scalene triangle (6) (5),(7),(8)
complete scalene triangle (7) (5),(6),(8)
cannot form a triangle (8) (5),(6),(7)

Create test cases

Test Case a b c Expected Output
WN1 5 5 5 Equilateral
WN2 5 5 4 Isosceles
WN3 3 4 5 Scalene
WN4 1 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 int
WR12 5 5.1 5 Value of b is not int
WR13 5 5 5.1 Value of c is not int

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324039064&siteId=291194637