0% found this document useful (0 votes)
9 views8 pages

Software Testing Practical File

The document summarizes two experiments from a software testing practical file. Experiment 1 involves writing a program to find the roots of a quadratic equation and performing boundary value analysis on it. Experiment 2 involves writing a program to calculate the area of different shapes like circle, triangle, square, rectangle and performing equivalence class testing on it. Both experiments include the program code and test cases with expected outputs.

Uploaded by

Ravneet Kaur
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views8 pages

Software Testing Practical File

The document summarizes two experiments from a software testing practical file. Experiment 1 involves writing a program to find the roots of a quadratic equation and performing boundary value analysis on it. Experiment 2 involves writing a program to calculate the area of different shapes like circle, triangle, square, rectangle and performing equivalence class testing on it. Both experiments include the program code and test cases with expected outputs.

Uploaded by

Ravneet Kaur
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

SOFTWARE TESTING

PRACTICAL FILE

By SANCHI VARMA 8th semester CSE II Roll No. - 61/1801322708

EXPERIMENT I AIM : WAP to find the roots of a quadratic equation and perform Boundary Value Analysis on it. Program : #include<iostream.h> #include<conio.h> #include<process.h> #include<math.h> void main() { clrscr(); int a,b,c,d; float r1, r2, x; cout<<"\nEnter Values of a (a>0),b & c in reference to equation : a(x^2)+bx+c\nRange [0,100] :\n"; cin>>a>>b>>c; if(a<0||b<0||c<0||a>100||b>100||c>100) { cout<<"Invalid Input Range"; getch(); exit(0); } else if (a==0) { cout<<"Not a Quadratic Equation"; getch(); exit(0); } else { d=(b*b)-(4*a*c); x=sqrt(d); r1=((-b)+x)/(2*a); r2=((-b)-x)/(2*a); if(d==0) cout<<"\nEqual Roots : "<<r1; else if (d<0) cout<<"\nImaginary Roots"; else cout<<"\nReal Roots : "<<r1<<" and "<<r2; } getch(); }

Test Cases :
TEST CASE ID 1 2 3 4 5 6 7 8 9 10 11 12 a 50 50 50 50 50 50 50 50 0 1 99 100 b 50 50 50 50 0 1 99 100 50 50 50 50 c 0 1 99 100 50 50 50 50 50 50 50 50 Expected Output Real Roots Real Roots Imaginary Roots Imaginary Roots Imaginary Roots Imaginary Roots Imaginary Roots Equal Roots Not a Quadratic Eqn Real Roots Imaginary Roots Imaginary Roots

Output :

EXPERIMENT II AIM : WAP to find area of circle, triangle, square and rectangle and perform Equivalence Class Testing on it Program : #include<iostream.h> #include<conio.h> #include<process.h> void main() { clrscr(); int ch; float b,h,area; cout<<"\n AREA OF SHAPES \n"; cout<<"*********************\n"; cout<<" 1 Circle\n 2 Triangle\n 3 Square\n 4 Rectangle\n 5 Exit\n"; cout<<"Enter Choice : "; cin>>ch; switch(ch) { case 1: cout<<"\nEnter Radius in cm (Valid range[1,200]):"; cin>>b; if(r<=0||r>200) { cout<<"Invalid Input"; getch(); exit(0); } else area=3.1415*b*b; cout<<"\nArea of Cirle = "<<area<<" cm^2"; break; case 2: cout<<"\nEnter base and height of triangle in cm (Valid range[1,200]) :\n"; cin>>b>>h; if(b<=0||b>200) { cout<<"Invalid input for base"; getch(); exit(0); } else if (h<=0||h>200) { cout<<"Invalid input for height"; getch(); exit(0); } else area=0.5*b*h; cout<<"Area of Triangle = "<<area<<" cm^2";

break; case 3: cout<<"\nEnter side of square in cm (Valid range[1,200]) :\n"; cin>>b; if(b<=0||b>200) { cout<<"Invalid input for side"; getch(); exit(0); } else area=b*b; cout<<"Area of Square = "<<area<<" cm^2"; break; case 4: cout<<"Enter Length and Breadth for Rectangle in cm (Valid range[1,200]) :\n"; cin>>b>>h; if(b<=0||b>200) { cout<<"Invalid input for length"; getch(); exit(0); } else if (h<=0||h>200) { cout<<"Invalid input for breadth"; getch(); exit(0); } else area=b*h; cout<<"Area of Square = "<<area<<" cm^2"; break; default : cout<<"Wrong Choice ! Terminating..."; getch(); exit(0); } getch(); }

Test Cases: Circle:


Test Case ID 1 2 3 r 0 100 201 Expected Output Invalid Input 31415 Invalid Input

Triangle:
Test Case ID 1 2 3 4 5 b 0 100 201 100 100 h 100 100 100 0 201 Expected Output Invalid Base Input 5000 Invalid Base Input Invalid Height Input Invalid Height Input

Square :
Test Case ID 1 2 3 s 0 100 201 Expected Output Invalid Input 10000 Invalid Input

Rectangle :
Test Case ID 1 2 3 4 5 l 0 100 201 100 100 b 100 100 100 0 201 Expected Output Invalid Length Input 10000 Invalid Length Input Invalid Breadth Input Invalid Breadth Input

Output :

You might also like