8/6/2019 st_file
1/19
INDEX
S.No.
Aim of Experiment DateTeachers
Sign.
1. To determine the nature of QuadraticEquation. And design Boundary Value testcases.
2.To determine the area of a Triangle, Square,Rectangle and a circle. Design EquivalenceClass test cases.
3.To determine previous date when its input ispresent date. Perform Decision TableTesting and design the test cases.
4.To determine the value of x raise to y andperform Decision Table based testing on it.
5.
To read the three sides of a triangle and tocheck whether the triangle is isosceles,equilateral or scalene and test the sameusing:
A. Cause Effect testing techniqueB. Path testing.
6.Compute the total salary of an employee,given his/her basic salary and other giveninformation.
8/6/2019 st_file
2/19
Experiment No. 1
Aim: To determine the nature of roots of a quadratic equation, its input is triple ofpositive integers x, y, z and values may be from interval [0,100]. The program outputmay have one of the following:
[Not a quadratic equation, real roots, imaginary roots, equal roots]Design the Boundary Value test cases.
Program:#include#includevoid main(){
clrscr();int x,y,z,d;cout
8/6/2019 st_file
3/19
4 50 50 99 IMAGINARY ROOTS IMAGINARY ROOTS
5 50 50 100 IMAGINARY ROOTS IMAGINARY ROOTS
6 50 0 50 IMAGINARY ROOTS IMAGINARY ROOTS
7 50 1 50 IMAGINARY ROOTS IMAGINARY ROOTS
8 50 99 50 IMAGINARY ROOTS IMAGINARY ROOTS
9 50 100 50 EQUAL ROOTS EQUAL ROOTS10 0 50 50 NOT A Q.E. NOT A Q.E.
11 1 50 50 REAL ROOTS REAL ROOTS
12 99 50 50 IMAGINARY ROOTS IMAGINARY ROOTS
13 100 50 50 IMAGINARY ROOTS IMAGINARY ROOTS
OUTPUTS:Test Case ID 1:
Test Case ID 3:
Test Case ID 9:
Test Case ID 10:
8/6/2019 st_file
4/19
Experiment No. 2
Aim: To determine the area of triangle, square, rectangle and a circle.Design the Equivalence Class test cases.
Program:#include#include#includevoid main(){
clrscr();int ch;char c;float b,h,a;I: cout
8/6/2019 st_file
5/19
a=b*b;cout
8/6/2019 st_file
6/19
Test Cases:In equivalence class testing, we find two types of equivalence classes: Input Domainand Output Domain.Input Domain is formed from one valid sequence and two invalid sequences. TheOutput domain is obtained from different types of outputs of a problem.
TRIANGLEInput Domain:I1: {h : h200}I3: {h : 1
8/6/2019 st_file
7/19
Output Domain:O1: { : Square if s>0}O2: { : Not a Square if s
8/6/2019 st_file
8/19
CIRCLEInput Domain:I1: {r : r200}I3: {r : 1
8/6/2019 st_file
9/19
Experiment No. 3
Aim: To determine previous date when its input is present date.1
8/6/2019 st_file
10/19
{ flag=0; }}
}if (flag){if(day==1)
{if(month==1){year--;day=31;month=12;
}else if(month==3){int rval=0;if(year%4==0){
rval=1;if(year%100==0 && (year%400)!=0){ rval=0; }}if(rval==1){day=29;month--; }
else{ day=28;month--; }
}
else if(month==2||month==4||month==6||month==9||month==11){ day=31;month--; }
else{ day=30;
month--; }}else{ day--; }printf("The previous date is:%d-%d-%d",day,month,year);
}else{ printf("The entered date is invlaid: %d-%d-%d",day,month,year); }getch();return 1;
}
8/6/2019 st_file
11/19
Test Cases:
Test CaseID
Month Day Year Expected O/P Observed O/P
12
3456
JuneJune
MayMarchAugust
February
131
1312929
19641984
1945200720071962
31-5-1964Impossible
30-4-194530-3-200728-8-2007Impossible
31-5-1964Impossible
30-4-194530-3-200728-8-2007Impossible
Output Screenshots:Test Case ID 1
Test Case ID 2
Test Case ID 3
Test Case ID 4
Test Case ID 5
Test Case ID 6
8/6/2019 st_file
12/19
Experiment No. 4
Aim: To determine the value of x raise to y and perform Decision Table basedtesting on it.Program:
#include#inlcude#includevoid main(){
clrscr();int x,y;float c;char ch;I: cout
8/6/2019 st_file
13/19
C5: x=-ve, y=-ve even T
C6: x=0, y=integer T
C7: x=integer, y=0 T
C8: x=-ve, y=-ve odd T
Actions
A1: Domain Error XA2: Negative O/P X X
A3: Output=1 X
A4: Positive O/P X X X
A5: Output=0 X
Output Screenshot:
8/6/2019 st_file
14/19
Experiment No. 5
Aim: To read the three sides of triangle, its input will be positive integers greaterthan 0 and less than or equal to 100 and to check whether the triangle isisosceles, equilateral or scalene and test the same using:
A. Cause effect graphing testing techniqueB. Path testing and deduce
1. Flow graph2. DD Path graph3. Independent paths4. Cyclomatic complexity
Program:#include //1#include //2int main() //3{ //4
clrscr(); //5int a,b,c,validinput=0; //6couta; //8coutb; //10coutc; //12if((a>0)&&(a0)&&(b0)&&(cc)&&((c+a)>b)&&((b+c>a))) //14
validinput=1; //15
else //16validinput=-1; //17
if(validinput==1) //18{ //19if((a==b)&&(b==c)) //20
cout
8/6/2019 st_file
15/19
A. Test Cases using Cause-Effect Graphing TechniqueCauses:C1: side a is less than sum of b and cC2: side b is less than sum of a and cC3: side c is less than sum of a and b
C4: side a is equal to side bC5: side a is equal to side cC6: side b is equal to side cEffects:E1: Not a triangleE2: Scalene triangleE3: Isosceles triangleE4: Equilateral triangleE5: ImpossibleCause-Effect Graph:
V
Decision Table:
Conditions R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11
C1: x
8/6/2019 st_file
16/19
Test Cases:
TEST CASE ID x y Z EXPECTED O/P OBSERVED O/P
1 4 1 2 Not a Triangle Not a Triangle
2 1 4 2 Not a Triangle Not a Triangle
3 1 2 4 Not a Triangle Not a Triangle
4 5 5 5 Equilateral Equilateral5 ? ? ? Not Possible Not Possible
6 ? ? ? Not Possible Not Possible
7 2 2 3 Isosceles Isosceles
8 ? ? ? Not Possible Not Possible
9 2 3 2 Isosceles Isosceles
10 3 2 2 Isosceles Isosceles
11 3 4 5 Scalene Scalene
B. Test Cases using Path-Testing Technique
Flow Graph:
1-12
1
3
1
5
1
8
1
7
1
6
1
4
1
9
2
7
2
0
2
8
2
9
3
0
2
2
2
1
2
3
2
4
2
5
3
1
3
2
3
3
2
6
8/6/2019 st_file
17/19
Mapping Table for DD-Path Graph:
Flow Graph Nodes DD Path GraphCorrespondingNodes
1-1213141516-171819-2021222324-25
26272829-3031-33
ABCDEFGHIJK
LMNOP
DD-Path Graph:
B
D
F
E
C
G
M
N
OIH
J K
P
L
A
8/6/2019 st_file
18/19
Independent Paths:1. ABCDFGHLP2. ABCEFGHLP3. ABFMOP4. ABFMNP
5. ABFGHLP6. ABFGIJLP7. ABFGIKLP
Cyclomatic Complexity:The Cyclomatic Complexity or the structural complexity of the above code can be foundby using three different ways:1. By using McCabes Cyclomatic Metric formulae:
V(G)=e-n+2PWhere V(G) is the cyclomatic metric of the graph G with n vertices, e edges and Pconnected components.
In this case, the value of e=21, n=16 and P=1Therefore, the value of V(G) is deduced to be 72. Predicate Decision Nodes:
V(G)=+1As there are 6 decision nodes, the value of V(G) is 73. Cyclomatic Complexity is equal to total number of regions of the flowgraph. As thereare 7 regions in our graph, the value of V(G) is 7.
Output Screenshots:Test Case ID 1
Test Case ID 4
Test Case ID 7
Test Case ID 11
8/6/2019 st_file
19/19
Experiment No. 6
Aim: Compute the total salary of an employee, given his/her basic salary and thefollowing slab is:HRA=30% of basic salary
DA=80% of basic salaryMA= Rs. 100TA= Rs. 800I.Tax= Rs. 700PF= Rs. 780Program:#include#includevoid main(){
clrscr() //1
float bs; //2coutbs; //4int hra,da,ma=100,ta=800,itax=700,pf=780; //5hra=0.3*bs; //6da=0.8*bs; //7cout