functional testing – Programmerbay https://programmerbay.com A Tech Bay for Tech Savvy Sun, 06 Dec 2020 13:55:35 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 https://programmerbay.com/wp-content/uploads/2019/09/cropped-without-transparent-32x32.jpg functional testing – Programmerbay https://programmerbay.com 32 32 Design test cases and test the program of Quadratic Equation problem using Robustness testing https://programmerbay.com/design-the-test-cases-and-test-the-program-of-quadratic-equation-problem-by-using-robustness-testing/ https://programmerbay.com/design-the-test-cases-and-test-the-program-of-quadratic-equation-problem-by-using-robustness-testing/#respond Sat, 19 Sep 2020 12:49:06 +0000 https://programmerbay.com/?p=5210 An equation is said to be a quadratic equation if only if it is in the form of ax2+bx+c where a can’t be 0. We will use the Quadratic formula for calculating the roots to check whether they are imaginary or real.

quadratic formula 1

This Quadratic formula is used only when b2– 4ac >= 0. such that, If b2– 4ac > 0 , means the equation has more than one real roots if b2– 4ac = 0 , means equal or single root if b2– 4ac <0, i3mplies imaginary root Lastly, if a is 0, then the equation would not be counted as a quadratic equation.

So, a quadratic equation can have [ Real, Equal, Imaginary, not quadratic ]

Program

Check out “Quadratic Equation” program along with its tested test cases.

Robustness Testing

We are assuming interval [0,10] where our input values will come in between and we will create test cases using Robustness testing accordingly.

In Robustness Testing, it will produce 6N+1 test cases which means, in this case, there will be 6*3+1 = 19 test cases.

Test IDabcExpected OutputProgram OutputTested Outcome
1-155Invalid InputInvalid InputPass
2055Not QuadraticNot QuadraticPass
3155RealRealPass
4955ImaginaryImaginaryPass
51055ImaginaryImaginaryPass
61155Invalid InputInvalid InputPass
75-15Invalid InputInvalid InputPass
8505ImaginaryImaginaryPass
9515ImaginaryImaginaryPass
10595ImaginaryImaginaryPass
115105EqualEqualPass
125115Invalid InputInvalid InputPass
1355-1Invalid InputInvalid InputPass
14550RealRealPass
15551RealRealPass
16559ImaginaryImaginaryPass
175510ImaginaryImaginaryPass
185511Invalid InputInvalid InputPass
19555ImaginaryImaginaryPass

How it is different from Boundary Value Analysis?

We can observe that previously we didn’t check for input values higher than the maximum boundary limit and lesser than the minimum boundary limit. In other words, we haven’t tested our code for Invalid Inputs in Boundary Value Analysis but in Robustness testing, we did make test cases for invalid inputs too and rewrite the code to fulfill this condition.

 

]]>
https://programmerbay.com/design-the-test-cases-and-test-the-program-of-quadratic-equation-problem-by-using-robustness-testing/feed/ 0
Design the test cases and test the program of Quadratic Equation problem by using Boundary Value Analysis https://programmerbay.com/design-the-test-cases-and-test-the-program-of-quadratic-equation-problem-by-using-boundary-value-analysis/ https://programmerbay.com/design-the-test-cases-and-test-the-program-of-quadratic-equation-problem-by-using-boundary-value-analysis/#respond Thu, 19 Sep 2019 11:05:42 +0000 https://programmerbay.com/?p=5180 A quadratic equation is an equation which must be in the form of ax2+bx+c where a can’t be 0. we use Quadratic formula to find roots and check whether the roots are real or imaginary.

quadratic formula 1

This Quadratic formula is applied only when b2– 4ac >= 0.
such that,
If b2– 4ac > 0 , means the eqn. has more than one real roots
if b2– 4ac = 0 , represent equal or single root
if b2– 4ac <0, represents imaginary root
Lastly, if a is 0, then the equation would not be considered as a quadratic equation.

So, a quadratic equation can have [ Real, Equal, Imaginary, not quadratic ]

We are supposing interval [0,10] where our input values will fall in between this interval and we will create test cases using Boundary Value Analysis accordingly.

Program:

#include<conio.h>
#include<stdio.h>
#include<math.h>
void main()
{
float a,b,c,result;
printf(" ax^2 + bx + c, \n enter the values of a, b and c : = ");
scanf("%f %f %f", &a,&b,&c);

result = (b*b)- (4*a*c);
if(a==0)
printf("not quadratic");
else if(result>0)
{
result= sqrt(result);
printf("Real roots are, %f,%f \n",(-b-result)/(2*a),(-b+result)/(2*a));
}
else if(result==0)
{
result= sqrt(result);
printf("equal root, %f,%f \n",(-b)/(2*a),(-b)/(2*a));
}
else
{
printf("Imaginary root");
}

getch();
}

 

 

Testing the Program


Real roots:

  real 1

Equal roots:

equal roots 1

Not Quadratic

not quadratic 1

Imaginary :

imaginary 1

In Boundary Value Analysis, there will be 4N+1 test cases which means 4*3+1 = 13 test cases will be generated 
Test IDabcExpected OutputProgram OutputTested Outcome
1055Not QuadraticNot QuadraticPass
2155RealRealPass
3955ImaginaryImaginaryPass
41055ImaginaryImaginaryPass
5505ImaginaryImaginaryPass
6515ImaginaryImaginaryPass
7595ImaginaryImaginaryPass
85105EqualEqualPass
9550RealRealPass
10551RealRealPass
11559ImaginaryImaginaryPass
125510ImaginaryImaginaryPass
13555ImaginaryImaginaryPass

]]>
https://programmerbay.com/design-the-test-cases-and-test-the-program-of-quadratic-equation-problem-by-using-boundary-value-analysis/feed/ 0