Software Testing Laboratory
Software Testing Laboratory
VI SEMESTER
SOFTWARE TESTING LABORATORY MANUAL
SUBJECT CODE: 10ISL68
By
Mr. ANIMESH GIRI
SOFTWARE TESTING
//Program 1: Decision table approach for solving triangle problem
/* Design and develop a program in a language of your choice to solve the triangle problem
defined as follows : Accept three integers which are supposed to be the three sides of
triangle and determine if the three values represent an equilateral triangle, isosceles
triangle, scalene triangle, or they do not form a triangle at all. Derive test cases for your
program based on decision-table approach, execute the test cases and discuss the results */
#include<stdio.h>
int main()
{
int a,b,c;
char istriangle;
printf("enter 3 integers which are sides of triangle\n");
scanf("%d%d%d",&a,&b,&c);
printf("a=%d\t,b=%d\t,c=%d",a,b,c);
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
Test Case Name :Decision table for triangle problem
Experiment Number : 1
Test Data : Enter the 3 Integer Value( a , b And c )
Pre-condition : a < b + c , b < a + c and c < a + b
Brief Description : Check whether given value for a equilateral, isosceles , Scalene triangle or can't from a triangle
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
/* Design and develop a program in a language of your choice to solve the triangle problem
defined as follows : Accept three integers which are supposed to be the three sides of triangle
and determine if the three values represent an equilateral triangle, isosceles triangle, scalene
triangle, or they do not form a triangle at all. Derive test cases for your program based on
boundary value analysis, execute the test cases and discuss the results */
#include<stdio.h>
int main()
{
int a,b,c,c1,c2,c3;
char istriangle;
do
{
printf("\nenter 3 integers which are sides of triangle\n");
scanf("%d%d%d",&a,&b,&c);
printf("\na=%d\tb=%d\tc=%d",a,b,c);
c1 = a>=1 && a<=10;
c2= b>=1 && b<=10;
c3= c>=1 && c<=10;
if (!c1)
printf("\nthe value of a=%d is not the range of permitted value",a);
if (!c2)
printf("\nthe value of b=%d is not the range of permitted value",b);
if (!c3)
printf("\nthe value of c=%d is not the range of permitted value",c);
} while(!(c1 && c2 && c3));
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
Test Case Name :Boundary Value Analysis for triangle problem
Experiment Number : 2
Test Data : Enter the 3 Integer Value( a , b And c )
Pre-condition : 1 ≤ a ≤ 10 , 1 ≤ b ≤ 10 and 1 ≤ c ≤ 10 and a < b + c , b < a + c and c < a + b
Brief Description : Check whether given value for a equilateral, isosceles , Scalene triangle or can't from a triangle
Input Data
Actual
Case Id Description Expected Output Status Comments
Output
A b c
Should display the message Equilateral
1 Enter the min value for a , b and c 1 1 1
triangle
Enter the min value for 2 items and Message should be displayed can't form a
2 1 1 2
min +1 for any one item1 triangle
Enter the min value for 2 items and Message should be displayed can't form a
3 1 2 1
min +1 for any one item1 triangle
Enter the min value for 2 items and Message should be displayed can't form a
4 2 1 1
min +1 for any one item1 triangle
Enter the normal value for 2 items Should display the message Isosceles
5 5 5 1
and 1 item is min value triangle
Enter the normal value for 2 items Should display the message Isosceles
6 5 1 5
and 1 item is min value triangle
Enter the normal value for 2 items Should display the message Isosceles
7 1 5 5
and 1 item is min value triangle
Should display the message Equilateral
8 Enter the normal Value for a, b and c 5 5 5
triangle
Enter the normal value for 2 items
9 5 5 10 Should display the message Not a triangle
and 1 item is max value
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
Enter the normal value for 2 items Should display the message Not a triangle
10 5 10 5
and 1 item is max value
Enter the normal value for 2 items Should display the message Not a triangle
11 10 5 5
and 1 item is max value
Enter the max value for 2 items and Should display the message Isosceles
12 10 10 9
max - 1 for any one item triangle
Enter the max value for 2 items and Should display the message Isosceles
13 10 9 10
max - 1 for any one item triangle
Enter the max value for 2 items and Should display the message Isosceles
14 9 10 10
max - 1 for any one item triangle
Should display the message Equilateral
15 Enter the max value for a, b and c 10 10 10
triangle
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
/* Design and develop a program in a language of your choice to solve the triangle problem
defined as follows : Accept three integers which are supposed to be the three sides of triangle
and determine if the three values represent an equilateral triangle, isosceles triangle, scalene
triangle, or they do not form a triangle at all. Derive test cases for your program based on
equivalence class partitioning , execute the test cases and discuss the results */
#include<stdio.h>
int main()
{
int a,b,c , c1,c2,c3;
char istriangle;
do
{
printf("\nenter 3 integers which are sides of triangle\n");
scanf("%d%d%d",&a,&b,&c);
printf("\na=%d\tb=%d\tc=%d",a,b,c);
c1 = a>=1 && a<=10;
c2= b>=1 && b<=10;
c3= c>=1 && c<=10;
if (!c1)
printf("\nthe value of a=%d is not the range of permitted value",a);
if (!c2)
printf("\nthe value of b=%d is not the range of permitted value",b);
if (!c3)
printf("\nthe value of c=%d is not the range of permitted value",c);
} while(!(c1 && c2 && c3));
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
1 //Program 4: (Dataflow Testing for commission calculation)
2 #include<stdio.h>
3 int main()
4 {
5 int locks, stocks, barrels, tlocks, tstocks, tbarrels;
6 float lprice,sprice,bprice,lsales,ssales,bsales,sales,comm;
7 lprice=45.0;
8 sprice=30.0;
9 bprice=25.0;
10 tlocks=0;
11 tstocks=0;
12 tbarrels=0;
13 printf("\nenter the number of locks and to exit the loop enter -1 for locks\n");
scanf("%d", &locks);
14 while(locks!=-1) {
15 printf("enter the number of stocks and barrels\n");
scanf("%d%d",&stocks,&barrels);
16 tlocks=tlocks+locks;
17 tstocks=tstocks+stocks;
18 tbarrels=btarrels+barrels;
19 printf("\nenter the number of locks and to exit the loop enter -1 for locks\n");
scanf("%d",&locks);
20 }
21 printf("\ntotal locks = %d\”,tlocks);
22 printf(“total stocks =%d\n”,tstocks);
23 printf(“total barrels =%d\n",tbarrels);
24 lsales = lprice*tlocks;
25 ssales=sprice*tstocks;
26 bsales=bprice*tbarrels;
27 sales=lsales+ssales+bsales;
28 printf("\nthe total sales=%f\n",sales);
29 if(sales > 1800.0)
30 {
31 comm=0.10*1000.0;
32 comm=comm+0.15*800;
33 comm=comm+0.20*(sales-1800.0);
}
34 else if(sales > 1000)
35 {
36 comm =0.10*1000;
37 comm=comm+0.15*(sales-1000);
}
38 else
39 comm=0.10*sales;
40 printf("the commission is=%f\n",comm);
41 return 0;
42 }
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
Begin the
(13 , 14) <13-14> Yes
loop
check for locks variable ( DEF(locks,13) ( 13 , 16) <13-14-15-16> Yes
6 ,DEF(locks,19) and
USE(locks,14),USE(locks,16) (19 , 14) <19-20-14> Yes
Repeat the
(19 , 16) <19-20-14-15-16> Yes
loop
Check for stocks variable (DEF(stocks,15) and
7 (15 , 17) <15-16-17> Yes
USE(stocks,17)
(27 ,28) <27-28> Yes
Check for sales DEF(sales, 27) and USE(Sales, (27 , 29) <27-28-29> Yes
28), USE(Sales , 29), USE(Sales,33) , (27 , 33) <27-28-29-30-31-32-33> Yes
8
USE(Sales , 34) , USE(Sales,37) , USE(Sales , (27 , 34) <27-28-29-34> Yes
39) (27 , 37) <27-28-29-34-35-36-37> Yes
(27 , 39) <27-28-29-34-38-39> Yes
( (31,32,33),42) <31-32-33-42> Yes
Check for Commission variable DEF(comm,
9 31,32,33) , DEF(comm,34,35) and ((34 , 35) , 42) <34-35-42> Yes
DEF(comm,39) and USE(comm,42) ((39 , 42 ) <39 - 42> Yes
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
//Program 5, 6 and 7 ( Boundary , Equivalence and Decision Test Case for
Commission Problem)
/* Design. develop, code and run the program in nay suitable language to solve the commission
problem. Analyze it from the perspective of boundary value, derive test cases, execute these test
cases and discuss the test results */
/* Assumption price for lock=45.0, stock=30.0 and barrels=25.0 production limit could sell in a
month 70 locks,80 stocks and 90 barrels commission on sales = 10 % <= 1000 and 15 % on
1000 to 1800 and 20 % on above 1800*/
#include<stdio.h>
int main()
{
int locks, stocks, barrels, tlocks, tstocks, tbarrels;
float lprice, sprice, bprice, sales, comm;
int c1,c2,c3,temp;
lprice=45.0;
sprice=30.0;
bprice=25.0;
tlocks=0;
tstocks=0;
tbarrels=0;
printf("\nenter the number of locks and to exit the loop enter -1 for locks\n");
scanf("%d",&locks);
while(locks!=-1)
{
c1=(locks<=0||locks>70);
printf("enter the number of stocks and barrels\n");
scanf("%d%d",&stocks,&barrels);
c2=(stocks<=0||stocks>80);
c3=(barrels<=0||barrels>90);
if(c1)
printf("value of locks not in the range 1..70 ");
else
{
temp=tlocks+locks;
if(temp>70)
printf("new total locks =%d not in the range 1..70 so old ",temp);
else
tlocks=temp;
}
printf("total locks = %d\n",tlocks);
if(c2)
printf("value of stocks not in the range 1..80 ");
else
{
temp=tstocks+stocks;
if(temp>80)
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
printf("new total stocks =%d not in the range 1..80 so old ",temp);
else
tstocks=temp;
}
printf("total stocks=%d\n",tstocks);
if(c3)
printf("value of barrels not in the range 1..90 ");
else
{
temp=tbarrels+barrels;
if(temp>90)
printf("new total barrels =%d not in the range 1..90 so old ",temp);
else
tbarrels=temp;
}
printf("total barrel=%d",tbarrels);
printf("\nenter the number of locks and to exit the loop enter -1 for locks\n");
scanf("%d",&locks);
}
printf("\ntotal locks = %d\ntotal stocks =%d\ntotal barrels =%d\n",tlocks,tstocks,tbarrels);
sales = lprice*tlocks+sprice*tstocks+bprice*tbarrels;
printf("\nthe total sales=%f\n",sales);
if(sales > 0)
{
if(sales > 1800.0)
{
comm=0.10*1000.0;
comm=comm+0.15*800;
comm=comm+0.20*(sales-1800.0);
}
else if(sales > 1000)
{
comm =0.10*1000;
comm=comm+0.15*(sales-1000);
}
else
comm=0.10*sales;
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
Test Case Name : Boundary Value for Commission Problem
Experiment Number : 5
Test data : price Rs for lock - 45.0 , stock - 30.0 and barrel - 25.0
sales = total lock * lock price + total stock * stock price + total barrel * barrel price
commission : 10% up to sales Rs 1000 , 15 % of the next Rs 800 and 20 % on any sales in excess of 1800
Pre-condition : lock = -1 to exit and 1< =lock < = 70 , 1<=stock <=80 and 1<=barrel<=90
Brief Description: The salesperson had to sell at least one complete rifle per month.
Checking boundary value for locks, stocks and barrels and commission
14 Enter the values to calculate the commission for 18 18 17 1775 216.25 Border point -
15 sales nearly less than 1800 18 17 18 1770 215.5 Border point -
16 17 18 18 1755 213.25 Border point -
17 Enter the values sales exactly equal to 1800 18 18 18 1800 220 Border point
18 18 18 19 1825 225 Border point +
Enter the values to calculate the commission for
19 sales nearly greater than 1800 18 19 18 1830 226 Border point +
20 19 18 18 1845 229 Border point +
Enter the values normal value for lock, stock and
21 barrel 48 48 48 4800 820 Midpoint
22 70 80 89 7775 1415 Output maximum -
Enter the max value for 2 items and max - 1 for
23 any one item 70 79 90 7770 1414 Output maximum -
24 69 80 90 7755 1411 Output maximum -
25 Enter the max value for locks,stocks and barrels 70 80 90 7800 1420 Output maximum
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
Test Case Name :Equivalence Class for Commission Problem
Experiment Number : 6
Test data : price Rs for lock - 45.0 , stock - 30.0 and barrel - 25.0
sales = total lock * lock price + total stock * stock price + total barrel * barrel price
commission : 10% Upto sales Rs 1000 , 15 % of the next Rs 800 and 20 % on any sales in excess of 1800
Pre-condition : lock = -1 to exit and 1< =lock < = 70 , 1<=stock <=80 and 1<=barrel<=90
Brief Description: The salesperson had to sell at least one complete rifle per month.
Checking boundary value for locks,stocks and barrels and commission
Valid Classes
L1 ={LOCKS :1 <=LOCKS<=70}
L2 ={Locks=-1}(occurs if locks=-1 is used to control input iteration)
L3 ={stocks : 1<=stocks<=80}
L4= {barrels :1<=barrels<=90}
Invalid Classes
L3 ={locks: locks=0 OR locks<-1}
L4 ={locks: locks> 70}
S2 ={stocks : stocks<1}
S3 ={stocks : stocks >80}
B2 ={barrels : barrels <1}
B3 =barrels : barrels >90}
Commission Problem Output Equivalence Class Testing
( Weak & Strong Normal Equivalence Class )
Input Data Expected Output Actual output
Case Stat
Description Total Total Total Commiss Comment
Id Sales Commission Sales us
Locks Stocks Barrels ion
Enter the value within the range for
1 35 40 45 3900 640
locks,stocks and barrels
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
Weak Robustness equivalence Class
Case Input Data Stat
Description Expected Output Actual output Comment
Id Locks Stocks Barrels us
Terminates the input loop and proceed
WR1 Enter the value locks = -1 -1 40 45 to calculate sales and commission ( if
Sales > 0)
Enter the value less than -1 or equal to
WR2 0 40 45 Value of Locks not in the range 1..70
zero for locks and other valid inputs
Enter the value greater than 70 for
WR3 71 40 45 Value of Locks not in the range 1..70
locks and other valid inputs
Enter the value less than or equal than
WR4 35 0 45 Value of stocks not in the range 1..80
0 for stocks and other valid inputs
Enter the value greater than 80 for
WR5 35 81 45 Value of stocks not in the range 1..80
stocks and other valid inputs
Enter the value less than or equal 0 for
WR6 35 40 0 Value of Barrels not in the range 1..90
barrels and other valid inputs
Enter the value greater than 90 for
WR7 35 40 91 Value of Barrels not in the range 1..90
barrels and other valid inputs
Strong Robustness equivalence Class
Case Input Data Stat
Description Expected Output Actual output Comment
Id Locks Stocks Barrels us
Enter the value less than -1 for locks
SR1 -2 40 45 Value of Locks not in the range 1..70
and other valid inputs
Enter the value less than or equal than
SR2 35 -1 45 Value of stocks not in the range 1..80
0 for stocks and other valid inputs
Enter the value less than or equal 0 for
SR3 35 40 -2 Value of Barrels not in the range 1..90
barrels and other valid inputs
Enter the locks and stocks less than or Value of Locks not in the range 1..70
SR4 -2 -1 45
equal to 0 and other valid inputs Value of stocks not in the range 1..80
Enter the locks and barrel less than or Value of Locks not in the range 1..70
SR5 -2 40 -1
equal to 0 and other valid inputs Value of Barrels not in the range 1..90
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
Enter the stocks and barrel less than or Value of stocks not in the range 1..80
SR6 35 -1 -1
equal to 0 and other valid inputs Value of Barrels not in the range 1..90
Value of Locks not in the range 1..70
Enter the stocks and barrel less than or Value of stocks not in the range 1..80
SR7 -2 -2 -2
equal to 0 and other valid inputs
Value of Barrels not in the range 1..90
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
Test Case Name :Decision Table for Commission Problem
Experiment Number : 7
Test data : price Rs for lock - 45.0 , stock - 30.0 and barrel - 25.0
sales = total lock * lock price + total stock * stock price + total barrel * barrel price
commission : 10% Upto sales Rs 1000 , 15 % of the next Rs 800 and 20 % on any sales in excess of 1800
Pre-condition : lock = -1 to exit and 1< =lock < = 70 , 1<=stock <=80 and 1<=barrel<=90
Brief Description: The salesperson had to sell at least one complete rifle per month.
Input data decision Table
RULES R1 R2 R3 R4 R5 R6 R7 R8 R10
Conditions C1: Locks = -1 T F F F F F F F F
C2 : 1 ≤ Locks ≤ 70 - T T F T F F F T
C3 : 1 ≤ Stocks ≤ 80 - T F T F T F F T
C4 : 1 ≤ Barrels ≤ 90 - F T T F F T F T
Actions a1 : Terminate the input loop X
a2 : Invalid locks input X X X X
a3 : Invalid stocks input X X X X
a4 : Invalid barrels input X X X X
a5 : Calculate total locks,stocks and barrels X X X X X X X
a5 : Calculate Sales X
a6: proceed to commission decision table X
Commission calculation Decision Table
Precondition : lock = -1
RULES R1 R2 R3 R4
C1 : Sales = 0 T F F F
C1 : Sales > 0 AND Sales ≤ 1000 T F F
Condition
C2 : Sales > 1001 AND sales ≤ 1800 T F
C3 : sales ≥1801 T
A1 : Terminate the program X
A2 : comm= 10%*sales X
Actions A3 : comm = 10%*1000 + (sales-1000)*15% X
A4 : comm = 10%*1000 + 15% * 800 + (sales-1800)*20% X
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
Precondition : Initial Value Total Locks= 0 , Total Stocks=0 and Total Barrels=0
Precondition Limit :Total locks, stocks and barrels should not exceed the limit 70,80 and 90 respectively
Commission Problem -Decision Table Test cases for input data
Case Input Data Actual Stat Comm
Description Loc Sto Barr Expected Output
Id Output us ents
ks cks els
Terminate the input loop check for sales if(sales=0) exit
1 Enter the value of Locks= -1 -1
from program else calculate commission
Total of locks,stocks is updated if it is with in a
Enter the valid input for lock and
2 20 30 -5 precondition limit and Should display value of barrels is not
stack and invalid for barrels
in the range 1..90
Total of locks, barrels is updated if it is with in a
Enter the valid input for lock and
3 15 -2 45 precondition limit and Should display value of barrels is not
barrels and invalid for stocks
in the range 1..80
Total of stocks , barrels is updated if it is with in a
Enter the valid input for lock and
4 -4 15 16 precondition limit and Should display value of barrels is not
barrels and invalid for stocks
in the range 1..70
Total of locks is updated if it is with in a precondition limit
Enter the valid input for lock
and (i)Should display value of stock is not in the range
5 and invalid value for stocks and 15 80 100
1..80 (ii)Should display value of barrels is not in the range
barrels
1..90
Total of stocks is updated if it is with in a precondition
Enter the valid input for stocks
limit and (i)Should display value of lock is not in the range
6 and invalid value for locks and 88 20 99
1..70 (ii)Should display value of barrels is not in the range
barrels
1..90
Total of barrels is updated if it is with in a precondition
Enter the valid input for barrels
20 limit and (i)Should display value of lock is not in the range
7 and invalid value for locks and 100 25
0 1..70 (ii)Should display value of stocks is not in the range
stocks
1..80
(i)Should display value of lock is not in the range 1..70
Enter the invalid input for lock , 40
8 -5 -9 (ii)Should display value of stocks is not in the range 1..80
stocks and barrels 0
(iii)Should display value of barrel in not in the range 1..90
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
Total of locks,stocks and barrels is updated if it is with in a
Enter the valid input for lock,
9 15 20 25 precondition limit and calculate the sales and proceed to
stocks and barrels
commission
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
Program 8(Binary Search - Path Testing)
/* Design, develop a code and run the program in any suitable language to implement the
binary search algorithm. Determine the basis paths and using them derive different test
cases execute these test cases and discuss the test results */
#include<stdio.h>
int binsrc(int x[],int low,int high,int key)
{
int mid;
while(low<=high)
{
mid=(low+high)/2;
if(x[mid]==key)
return mid;
if(x[mid]<key)
low=mid+1;
else
high=mid-1;
}
return -1;
}
int main()
{
int a[20],key,i,n,succ;
printf("Enter the n value");
scanf("%d",&n);
if(n>0)
{
printf("enter the elements in ascending order\n");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
#include<stdio.h>
void quicksort(int x[10],int first,int last)
{
int temp,pivot,i,j;
if(first<last)
{
pivot=first;
i=first;
j=last;
while(i<j)
{
while(x[i]<=x[pivot] && i<last)
i++;
while(x[j]>=x[pivot])
j--;
if(i<j)
{
temp=x[i];
x[i]=x[j];
x[j]=temp;
}
}
temp=x[pivot];
x[pivot]=x[j];
x[j]=temp;
quicksort(x,first,j-1);
quicksort(x,j+1,last);
}
}
// main program
int main()
{
int a[20],i,key,n;
printf("enter the size of the array");
scanf("%d",&n);
if(n>0)
{
printf("enter the elements of the array");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
quicksort(a,0,n-1);
printf("the elements in the sorted array is:\n");
for(i=0;i<n;i++)
printf("%d\t",a[i]);
}
else
{
printf(“size of array is invalid\n”);
}
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
A Initialization
Recursive Calls
Independent Paths– Quick Sort
P1: A-B-N
P2: A-B-C-J-K-B
P3: A-B-C-J-K-M-B
P4: A-B-C-D-F-H-C
P5: A-B-C-D-F-H-I-C
P6: A-B-C-D-E-D-F-H
P7: A-B-C-D-F-G-F-H
Pre-Conditions/Issues:
Array has only one Element, Two Elements, Three Elements (6 Possibilities)
Array has Elements in ASC/DSC/Arbitrary( Any of the Permutations)
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
EX: 3 elements: 123, 132, 213, 231, 312, 321, + 222,111,333
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
Pre-Conditions/Issues:
Percentage Per is a positive Float Number
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
Program 11 and 12 ( Next date program)
/* Design,develop,code and run the program in any suitable language to implement the
NextDate function. Analyze it from the perspective boundary value testing and equivalence
class analysis. Derive different test cases, execute these test cases and discuss the test results. */
#include<stdio.h>
int check(int day,int month)
{
if((month==4||month==6||month==9 ||month==11) && day==31)
return 1;
else
return 0;
}
int isleap(int year)
{
if((year%4==0 && year%100!=0) || year%400==0)
return 1;
else
return 0;
}
int main()
{
int day,month,year,tomm_day,tomm_month,tomm_year;
char flag;
do
{
flag='y';
printf("\nenter the today's date in the form of dd mm yyyy\n");
scanf("%d%d%d",&day,&month,&year);
tomm_month=month;
tomm_year= year;
if(day<1 || day>31)
{
printf("value of day, not in the range 1...31\n");
flag='n';
}
if(month<1 || month>12)
{
printf("value of month, not in the range 1....12\n");
flag='n';
}
else if(check(day,month))
{
printf("value of day, not in the range day<=30");
flag='n';
}
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
if(year<=1812 || year>2013)
{
printf("value of year, not in the range 1812.......2013\n");
flag='n';
}
if(month==2)
{
if(isleap(year) && day>29)
{
printf("invalid date input for leap year");
flag='n';
}
else if(!(isleap(year))&& day>28)
{
printf("invalid date input for not a leap year");
flag='n';
}
}
}while(flag=='n');
switch (month)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:if(day<31)
tomm_day=day+1;
else
{
tomm_day=1;
tomm_month=month+1;
}
break;
case 4:
case 6:
case 9:
case 11: if(day<30)
tomm_day=day+1;
else
{
tomm_day=1;
tomm_month=month+1;
}
break;
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
case 12: if(day<31)
tomm_day=day+1;
else
{
tomm_day=1;
tomm_month=1;
if(year==2013)
{
printf("the next day is out of boundary value of year\n");
tomm_year=year+1;
}
else
tomm_year=year+1;
}
break;
case 2:
if(day<28)
tomm_day=day+1;
else if(isleap(year)&& day==28)
tomm_day=day+1;
else if(day==28 || day==29)
{
tomm_day=1;
tomm_month=3;
}
break;
}
printf("next day is : %d %d %d",tomm_day,tomm_month,tomm_year);
return 0;}
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
Test Case Name : Boundary Value Analysis test cases for Next date program
Experiment Number : 11
Test data : Enter the three integer value
Pre-condition : Month 1 to 12 , DAY 1 TO 31 AND YEAR 1812 TO 2013 / we are consider one corner of the input space
Min Max
Brief Description : Min +1 Normal -1 Max
Month 1 2 6 11 12
Day 1 2 15 30 31
Year 1812 1813 1912 2012 2013
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
Enter the min+1 value for day , normal
8 value for year and min value for month 1 2 1912 1 3 1912
Enter the min+1 value for day , max -1
9 value for year and min value for month 1 2 2012 1 3 2012
Enter the min+1 value for day , max
10 value for year and min value for month 1 2 2013 1 3 2013
Enter the normal value of day and min
11 for year and month 1 15 1812 1 16 1812
Enter the normal value for day and
12 min+1 for year and min for month 1 15 1813 1 16 1813
Enter the normal value for day normal
13 value for year and min value for month 1 15 1912 1 16 1912
Enter the normal value for day , max -1
14 value for year and min value for month 1 15 2012 1 16 2012
Enter the normal value for day , max
15 value for year and min value for month 1 15 2013 1 16 2013
Enter the max - 1 value of day and min
16 for day and year 1 30 1812 1 31 1812
Enter the max -1 value for day and min
17 for month and min+1 for year 1 30 1813 1 31 1813
Enter the max - 1 value for day , normal
18 value for year and min value for month 1 30 1912 1 31 1912
Enter the max - 1 value for day , max -1
19 value for year and min value for month 1 30 2012 1 31 2012
Enter the max -1 value for day , max
20 value for year and min value for month 1 30 2013 1 31 2013
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
Enter the max value of day and min for
year and month
21 1 31 1812 2 1 1812
Enter the max value for day and min for
month and min + 1 for year
22 1 31 1813 2 1 1813
Enter the max value for day , normal
value for year and min value for month 1 31 1912 2 1 1912
Enter the max value for day , max -1
value for year and min value for month
24 1 31 2012 2 1 2012
Enter the max value for day , max
25 value for year and min value for month 1 31 2013 2 1 2013
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
Test Case Name : Equivalence class test cases for Next date
Experiment Number : 12
Test data : Enter the three integer value
Pre-condition : Month 1 to 12 , DAY 1 TO 31 AND YEAR 1812 TO 2013
Valid Cases
M1 = { month ; 1 ≤ month ≤ 12 }
D1 = { day : 1 ≤ day ≤ 31 }
Y1 = { year : 1812 ≤ year ≤ 2013 }
Invalid cases
M2 = {month : month < 1}
M3 = {month : month > 12}
D2 = {day : day < 1}
D3 = {day : day > 31}
Y2 = {year : year < 1812}
Y3 = {year : year > 2013}
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
(Strong Robustness Equivalence Class )
Case Input Data Com
Description Expected Output Actual output Status
Id month day year ment
Should display the message value of the
SR1 Enter the M2 , D1 and Y1 cases -1 15 1912
month not in the range 1..12
Should display the message value of the
SR2 Enter the M1, D2 and Y1 cases 6 -1 1912
day not in the range 1..31
Should display the message value of the
SR3 Enter the M1, D1 and Y2 cases 6 15 1811
year not in the range 1812..2013
(i)Should display the message value of the
month in range 1..12
SR4 Enter the M2 , D2 and Y1 cases -1 -1 1912
(ii) Should display the message value of
the day in range 1..31
(i) Should display the message value of
the day in range 1..31
SR5 Enter the M1, D2 and Y2 cases 6 -1 1811
(ii) Should display the message value of
the year in range 1812..2013
(i)Should display the message value of the
month in range 1..12
SR6 Enter the M2, D1 and Y2 cases -1 15 1811
(ii) Should display the message value of
the year in range 1812..2013
(i)Should display the message value of the
month in range 1..12
(ii) Should display the message value of
SR7 Enter the M2, D2 and Y2 cases -1 -1 1811
the day in range 1..31
(iii) Should display the message value of
the year in range 1812..2013
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68
SOFTWARE TESTING
Some addition equivalence Boundary checking
Case Id Description Input Data Expected Output Actual output Status Comment
day mo year day month year day mo year
nth nth
1 Enter the D1, M1 and Y1 valid 31 12 1811 Should display the
cases message value of the
year in range
1812..2013
2 Enter the D1, M1 and Y2 valid 31 12 2012 1 1 2013
cases
3 Enter the D1, M1 and Y3 valid 31 12 2013 Should display the
cases message Next is out of
boundary 2013
PESIT Bangalore South Campus LAB MANUAL BE. VI Sem ISE 10ISL68