# Boundary Value Test Cases, Robust Cases and Worst Case Test Cases

• Last Updated : 29 May, 2020

Generate boundary Value analysis, robust and worst-case test case for the program to find the median of three numbers. Its input is a triple of positive integers (say x, y, and z) and the minimum value can be 100 and maximum can be 500.

Median of three numbers is the middle number when all three numbers are sorted.

Example –

`10, 40, 20`

In this case, the median is 20 (10, 20, 40).

1. Boundary Value Test Cases are –

```for x, y, z :
min value = 100
close to min = 101
nominal = 300
close to max = 499
max = 500 ```

Test cases are,

`4*3 + 1 = 13 `

XYZMedian
100300300300
101300300300
300300300300
499300300300
500300300300
300100300300
300101300300
300499300300
300500300300
300300100300
300300101300
300300499300
300300500300

2. Robust Test Cases –
Here, we go outside the legitimate boundary, it is an extension of boundary value analysis.

```for x, y, z :
min value : 100
close to min : 101
nominal : 300
close to max : 499
max : 500
lesser than min value : 99
larger than max value : 501  ```

Total test cases,

`= 6*n+1 = 6*3+1 = 19 `

So there will be extra 6 cases apart from the above 13 cases –

XYZ
99300300
501300300
30099300
300501300
30030099
300300501

3. Worst Test Cases –
If we reject “single” fault assumption theory of reliability, and consider cases where more than 1 variable has extreme values, then it is known as worst case analysis.

Total no. of test cases,

`5^n = 5^3 = 125 cases `

XYZMedian
100100100100
101100100100
300100100100
499100100100
500100100100
100101100100
101101100101
300101100101
499101100101

Mathematically, the test cases will be a cross product of 3 sets –

```  {100, 101, 300, 499, 500}
x {100, 101, 300, 499, 500}
x {100, 101, 300, 499, 500}```

Let set A,

`= {100, 101, 300, 499, 500}`

So, the set of worst cases will be represented by,

`= A x A x A `
My Personal Notes arrow_drop_up