Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

ST_Lab

Download as pdf or txt
Download as pdf or txt
You are on page 1of 53

SOFTWARE TESTING

(KCS 751A)
LABORATORY MANUAL
B.TECH, 4th Year, Semester - VII

Dr. A.P.J. Abdul Kalam Technical University,


Uttar Pradesh

COMPUTER SCIENCE
&
ENGINEERING

Faculty Name: - Student Name:-

Assistant Professor Roll No:-

Year & Section:-


MANUAL CONTENTS

This manual is intended for the 4th year students of Computer Science & Engineering in the subject of
Software Testing. This manual typically contains practical/lab sessions related Software Testing
covering various aspects related the subject to enhanced understanding.

Students are advised to thoroughly go through this manual rather than only topics mentioned in the
syllabus as practical aspects are the key to understanding and conceptual visualization of theoretical
aspects covered in the books.

Good Luck for your Enjoyable Laboratory Sessions.


PREFACE
This practical manual will be helpful for students of Computer Science & Engineering for
understanding the course from the point of view of applied aspects. Though all the efforts have been
made to make this manual error free, yet some errors might have crept in inadvertently. Suggestions
from the readers for the improvement of the manual are most welcomed.

Vision of the Institute


“To become a leading institute of providing professionally competent and socially responsive
technocrats with high moral values.”

Mission of the Institute


M1. To create an eco-system for the dissemination of technical knowledge, to achieve academic
excellence.

M2. To develop technocrats with creative skills and leadership qualities, to solve local and global
challenges.

M3. To impart human values and ethics in students, to make them socially and eco-friendly
responsible.
Vision of the Department
“To produce globally competent professionals having social values and commitment to serve the
global needs with the ability to work in an interdisciplinary environment.”

Mission of the Department


M1. "To impart quality education to the students to enhance their ethical, professional and leadership
qualities to make them globally competitive."

M2. "To create a conducive environment in which students can explore computational problems and
analyze them to identify the optimal solutions."

M3. "To strive for continual enhancement of technical knowledge & innovation through industry
interface to accomplish global needs."

Program Educational Objectives (PEOs)


PEO1: Students must be able to apply software engineering principles to analyze complex computing
problems and identify their solutions.

PEO2: Students must be able to analyze, design, and implement the latest technology-driven projects.

PEO3: Students must be able to work in a collaborative environment and understand the ethical,
social, and economic impact of their work.
Program Outcomes (POs)

PO’s An Engineering Graduate of the Department of Computer Science and Engineering Program will
be able to demonstrate:

PO1 ENGINEERING KNOWLEDGE: Apply the knowledge of mathematics, including discrete


mathematics, probability, statistics and fundamentals of various engineering disciplines like computer
science and engineering, electronic engineering and Electrical engineering in the core information
technologies.
PO2 PROBLEM ANALYSIS: Analyze a problem and identify the computing requirements
appropriate to its solution.
PO3 DESIGN/DEVELOPMENT OF SOLUTIONS: Design and implement hardware and software
systems, components, process or program to meet the desired needs within reasonable economic,
environmental, social, political, ethical, health and safety, manufacturability, and sustainability
constraints.
PO4 CONDUCT INVESTIGATIONS OF COMPLEX PROBLEMS: Reassess literature and indulge
in research to use research-based knowledge and methods to design and conduct new experiments, as
well as to organize, analyze and interpret data to produce draw valid Conclusions and
recommendations.
PO5 MODERN TOOL USAGE: Use appropriate techniques, resources, and modern engineering and
IT tools necessary for computer engineering practice.
PO6 THE ENGINEER AND SOCIETY: Show the understanding of local and global impact of
computing on individuals, organizations and society.
PO7 ENVIRONMENT AND SUSTAINABILITY: Integrate IT-based solutions in environmental
contexts, and demonstrate the knowledge of need for sustainable development.
PO8 ETHICS: Demonstrate the knowledge of professional and ethical responsibilities along with the
norms of the engineering practice.
PO9 INDIVIDUAL AND TEAM WORK: Demonstrate leadership and an ability to work as a
member with responsibility to function on multi-disciplinary teams to accomplish a common goal.
PO10 COMMUNICATION: Demonstrate effectively communicate skills in both oral and written
form with a range of audiences.

PO11 PROJECT MANAGEMENT AND FINANCE: Apply the knowledge and understanding of
engineering and management principles to design, planned budget and propose IT project for an
identified need within a specific scope.
PO12 LIFE-LONG LEARNING: Developed confidence to acquire new knowledge in the computing
discipline and to engage in life-long learning.

Program Specific Outcomes (PSOs)

PSO 1: Able to design and implement the data structures and algorithms to deliver quality software
products.
PSO 2: Able to apply Artificial Intelligence and Machine Learning concepts to solve society-related
needs.

Course Outcomes (COs)

Course Outcomes: The students should be able to: Bloom's


Level
Design the solution for given problem in any programming
CO1 L5
language and Derive test cases for the problem
CO2 Apply the appropriate technique for the design of flow graph L5
INDEX
S. EXPERIMENT COs BL Date Sign.
No.
1 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 a triangle and determine if the
three values represent an equilateral triangle, isosceles
CO1 L5
triangle, scalene triangle, or they do not form a
triangle at all. Assume that the upper limit for the size
of any side is 10. Derive test cases for your program
based on boundary-value analysis, execute the test
cases and discuss the results.
2 Design, develop, code and run the program in any
suitable language to implement the NextDate
function. Analyze it from the perspective of CO1 L5
boundary value testing, derive different test cases,
execute these test cases and discuss the test results.
3 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 a triangle and determine if
the three values represent an equilateral triangle,
isosceles triangle, scalene triangle, or they do not CO1 L5
form a triangle at all. Assume the upper limit for the
size of any side is 10. Derive test cases for your
program based on equivalence class partitioning,
execute the test cases and discuss the results.

4 Design, develop, code and run the program in any


suitable language to implement the NextDate
function. Analyze it from the perspective of
CO1 L5
equivalence class value testing, derive different test
cases, execute these test cases and discuss the test
results.
5 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 a triangle and
CO1 L5
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.
6 Design, develop, code and run the program in
any suitable language to solve the commission
problem. Analyse it from the perspective of
CO1 L5
decision table- based testing, derive different
test cases, execute these test cases and discuss
the test results.
7 Design, develop, code and run the program in
any suitable language to solve the commission
problem. Analyse it from the perspective of
CO1 L5
dataflow testing, derive different test cases,
execute these test cases and discuss the test
results
8 Design, develop, code and run the program in
any suitable language to implement the binary
search algorithm. Determine the basis paths and CO2 L5
using them derive different test cases, execute
these test cases and discuss the test results.
9 Design, develop, code and run the program in
any suitable language to implement the
Quicksort algorithm. Determine the basis paths
CO2 L5
and using them derive different test cases,
execute these test cases and discuss the test
results.
10 Design, develop, code and run the program in
any suitable language to implement an absolute
letter grading procedure, making suitable
CO2 L5
assumptions. Determine the basis paths and
using them derive different cases, execute these
test cases and discuss the test results.
INTRODUCTION

Aims

The aim of this course is to identify the need of software testing in current industry scenario, techniques and
tools in area of software testing and to detect software failures so that defects may be discovered and
corrected. Practical experimentation with the language is strongly encouraged.

Course Objectives

At the end of the course, students will be able to:


1. Demonstrate the ability to apply multiple methods to check reliability of a software system and to
identify and apply redundancy and fault tolerance for a medium-sized application.
2. Identify the Fault in program logic that fails to validate data and values properly before they are used.
3. Discuss the distinctions between validation and defect testing.
4. Understand types of testing and essential characteristics of tool used for test automation
Experiment No.1
Aim: -Design and develop a program to solve the triangle problem defined as follows: Accept three
integers which are supposed to be the three sides of a triangle and determine if the three values represent
an equilateral triangle, isosceles triangle, scalene triangle, or they do not form a triangle at all. Assume
that the upper limit for the size of any side is 10. Derive test cases for your program based on boundary-
value analysis, execute the test cases and discuss the results.

Program: -
#include<stdio.h>
#include<conio.h>
int main( )
{
int a,b,c,c1,c2,c3;
do
{
printf("enter the sides of triangle\n");
scanf("%d%d%d",&a,&b,&c);
c1=((a>=1) && (a<=10));
c2=((b>=1) && (b<=10));
c3=((c>=1) && (c<=10));
if(!c1)
printf("value of a is out of range");
if(!c2)
printf("value of b is out of range");
if(!c3)
printf("value of c is out of range");
}
while(!c1 || !c2 || !c3);
if((a+b)>c && (b+c)>a && (c+a)>b)
{
if(a==b && b==c)
printf("Triangle is equilateral\n");
else if (a!=b && b!=c && c!=a)
printf("Triangle is scalene\n");
else
printf("Triangle is isosceles\n");
}
else printf("Triangle cannot be formed \n");
getch( ); return 0;
}

INPUT/OUTPUT
Test cases using Boundary value analysis for Triangle Program

Testcases Inputs
Description Output Comments
A B C
BVA1 Enter the values of a(nom),b(nom) and 5 5 1 Isosceles Valid
c(min)
BVA 2 Enter the values of a(nom),b(nom) and 5 5 2 Isosceles Valid
c(min+)
BVA 3 Enter the values of a(nom),b(nom) and 5 5 5 Equilateral Valid
c(nom)
BVA 4 Enter the values of a(nom),b(nom) and 5 5 9 Isosceles Valid
c(max-)
BVA 5 Enter the values of a(nom),b(nom) and 5 5 10 Triangle cannot be Valid
c(max) formed
BVA 6 Enter the values of a(nom),b(min) and 5 1 5 Isosceles Valid
c(nom)
BVA 7 Enter the values of a(nom),b(min+) 5 2 5 Isosceles Valid
and c(nom)
BVA 8 Enter the values of a(nom),b(max-) 5 9 5 Isosceles Valid
and c(nom)
BVA 9 Enter the values of a(nom),b(max) and 5 10 5 Triangle cannot be Valid
c(nom) formed
BVA 10 Enter the values of a(min),b(nom) and 1 5 5 Isosceles Valid
c(nom)
BVA 11 Enter the values of a(min+),b(nom) 2 5 5 Isosceles Valid
and c(nom)
BVA 12 Enter the values of a(max-),b(nom) 9 5 5 Isosceles Valid
and c(nom)
BVA 13 Enter the values of a(max),b(nom) and 10 5 5 Triangle cannot be Valid
c(nom) formed
Experiment No. 2

Aim: Design, develop, code and run the program to implement the NextDate function. Analyze it from the
perspective of boundary value testing, derive different test cases, execute these test cases and discuss the
test results.

Program: -
#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';
}
if(year<=1812 || year>2015)

{
printf("value of year, not in the range 1812. ...... 2015\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; case 12: if(day<31) tomm_day=day+1; else

{
tomm_day=1;
tomm_month=1; if(year==2015)
{
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(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;
}

INPUT/OUTPUT
Considering Date program, we have three variables day, month and year.

Variables Min Min+ Nom Max- Max


day 1 2 15 30 31

month 1 2 6 11 12

year 1812 1813 1914 2014 2015


Test cases for Date program using Boundary Value Analysis

Test Inputs
cases Description Output Comments
DD MM YY
BVA1 15 6 1812 16/6/1812 Valid
Enter the values for
day(nom),month(nom) and year(min)
BVA2 15 6 1813 16/6/1813 Valid
Enter the values for
day(nom),month(nom) and year(min+)
Enter the values for 15 6 1914 16/6/1914
BVA 3 day(nom),month(min) and year(nom) Valid
Enter the values for 15 6 2014 16/6/2014
BVA4 day(nom),month(nom) and year(max-) Valid
Enter the values for 15 6 2015 16/6/2015
BVA5 day(nom),month(nom) and year(max) Valid
Enter the values for 15 1 1914 16/1/1914
BVA6 day(nom),month(min) and year(nom) Valid
Enter the values for 15 2 1914 16/2/1914
BVA7 day(nom),month(min+) and year(nom) Valid
Enter the values for 15 11 1914 16/11/1914
BVA8 day(nom),month(max-) and year(nom) Valid
Enter the values for 15 12 1914 16/12/1914
BVA9 day(nom),month(max) and year(nom) Valid
Enter the values for 1 6 1914 2/6/1914
BVA10 day(min),month(nom) and year(nom) Valid
Enter the values for 2 6 1914 3/6/1914
BVA11 day(min+),month(nom) and year(nom) Valid
Enter the values for day(max- 30 6 1914 1/7/1914
BVA12 ),month(nom) and year(nom) Valid
BVA13 Enter the values for 31 6 1914 Day out of Valid
day(max),month(nom) and year(nom) rangefor
the
month
Experiment No. 3

Aim: Design and develop a program to solve the triangle problem defined as follows: Accept three integers
which are supposed to be the three sides of a triangle and determine if the three values represent an
equilateral triangle, isosceles triangle, scalene triangle, or they do not form a triangle at all. Assume the
upper limit for the size of any side is 10. Derive test cases for your program based on equivalence class
partitioning, execute the test cases and discuss the results.

Program:
#include<stdio.h> #include<conio.h>
int main()
{
int a,b,c,c1,c2,c3;
do
{
printf("enter the sides of triangle\n"); scanf("%d%d%d",&a,&b,&c); c1=((a>=1) && (a<=10));
c2=((b>=1) && (b<=10));
c3=((c>=1) && (c<=10)); if(!c1)
printf("value of a is out of range"); if(!c2)
printf("value of b is out of range"); if(!c3)
printf("value of c is out of range");
}while(!c1 || !c2 || !c3);
if((a+b)>c && (b+c)>a && (c+a)>b)
{

if(a==b && b==c)


printf("triangle is equilateral\n"); else if(a!=b && b!=c && c!=a) printf("triangle is scalene\n");
else
printf("triangle is isosceles\n");
}
else
printf("triangle cannot be formed \n");
getch( );
return 0;
}
INPUT/ OUTPUT
Equivalence Class Test For The Triangle Program
Output Equivalence Classes are as follows:
R1={<a,b,c>:the triangle with sides a,b and c is Equilateral}
R2={<a,b,c>:the triangle with sides a,b and c is Isosceles}
R3={<a,b,c>:the triangle with sides a,b and c is Scalene}
R4={<a,b,c>:sides a,b and c do not form a Triangle}

Weak Normal /Strong Normal

Inputs Expected
Test cases Description output Comments
A B C
Enter the valid values for a, b and
WN/SN1 5 5 5 Equilateral Valid
c from outputequivalence classes.
Enter the valid values for a, b and
WN/SN2 c from outputequivalence classes. 5 5 3 Isosceles Valid
Enter the valid values for a, b and
WN/SN3 c from outputequivalence classes. 5 3 4 Scalene Valid
Enter the valid values for a, b and Triangle
WN/SN4 c from outputequivalence classes. 10 1 1 cannotbe Valid
formed

Weak Robust

Testcases Inputs
Description Expected output Comments
A B C
WR 1 Enter the valid values for b and c -1 5 5 Value of a is notin a Triangle
from outputequivalence classes range cannot be
and invalid value for a. formed
WR 2 Enter the valid values for a and 3 -1 4 Value of b is not Triangle
c from output in a range cannot be
equivalence classes and invalid formed
value for b.
WR 3 Enter the valid values for a and b 10 10 -1 Value of c is notin a Triangle
from outputequivalence classes range cannot be
and invalid value for c. formed
WR 4 Enter the valid values for b and c 11 3 3 Value of a is not in a Triangle
from outputequivalence classes range cannot be
and invalid value for a. formed
WR 5 Enter the valid values for a and 5 11 6 Value of b is not Triangle
c from output in a range cannot be
equivalence classes and invalid formed
value for b.
WR 6 Enter the valid values for a and b 9 10 11 Value of c is notin a Triangle
from outputequivalence classes range cannot be
and invalid value for c. formed

Strong Robust
Inputs
Test Description Expected Comments
cases A B C output
SR 1 Enter the valid value for b from output -1 3 -1 Values of a and Triangle cannot
equivalenceclasses and invalid values care not in range beformed
for a and c.
SR 2 Enter the valid value for a from output 5 -1 -1 Values of b and Triangle cannot
equivalenceclasses and invalid values care not in range beformed
for b and c.
SR 3 Enter the valid value for c from output -1 -1 10 Values of a and Triangle cannot
equivalenceclasses and invalid values bare not in range beformed
for a and b.
SR 4 Enter the valid value for a from output 7 11 11 Values of b and Triangle cannot

equivalenceclasses and invalid values care not in range beformed


for b and c.
SR 5 Enter the valid value for c from output 11 11 10 Values of a and Triangle cannot
equivalenceclasses and invalid values bare not in range beformed
for a and b.
SR 6 Enter the valid value for b from 11 5 11 Values of a and Triangle cannot
output equivalenceclasses and invalid care not in range beformed
values for a and c.
SR 7 Enter the valid values for b and c -1 5 5 Values of a is not Triangle cannot
from output equivalence classes in range be formed
and invalid value for a.
SR 8 Enter the valid values for a and c from 10 -1 10 Values of b is not Triangle cannot
output equivalence classes and invalid in range be formed
value for b.
SR 9 Enter the valid values for a and b 7 6 -1 Values of c is not Triangle cannot
from output equivalence classes in range be formed
and invalid value for c.
SR 10 Enter the valid values for b and c 11 5 4 Values of a is not Triangle cannot
from output equivalence classes in range be formed
and invalid value for a.
SR 11 Enter the valid values for a and c from 2 11 3 Values of b is not Triangle cannot
output equivalence classes and invalid in range be formed
value for b.
SR 12 Enter the valid values for a and b 3 4 11 Values of c is not Triangle cannot
from output equivalence classes in range be formed
and invalid value for c.
Values of a, b and Triangle cannot
SR 13 Enter the invalid value for a, b and c. 11 11 11 c are not in a be formed
range
SR 14 -1 -1 -1 Values of a, b Triangle cannot
Enter the invalid value for a, b and c. and c are not in be formed
a range
Experiment No. 4

Aim: Design, develop, code and run the program to implement the NextDate function. Analyze it
from the perspective of equivalence class value testing, derive different test cases, execute these test
cases and discuss the test results.

Equivalence class testing for next date program


Equivalence Classes are as follows:
D1= { Day/DD : 1<=DD<=31 }
M1= { Month/MM : 1<=MM<=12 }
Y1= { Year /YY: 1812<=YY<=2015 }

Weak Normal /Strong Normal

Inputs
Test Description Output Comments
cases DD MM YY
WN/SN1 Enter valid values for day, 12 2 1990 13/2/1990 Valid
month and year from
equivalence classes.

Weak Robust

Testcases Inputs
Description Output Comments
DD MM YY
WR1 Enter valid values for month and year from -1 6 1992 Day out of Valid
equivalenceclasses and invalid value for range
day.
Enter valid values for day and year 15 -1 1992 Month out Valid
WR2 from equivalenceclasses and invalid of range
value for month.
Enter valid values for day and month from 15 6 1811 Year out of Valid
WR3 equivalenceclasses and invalid value for range
year.
Enter valid values for month and year from 32 6 1992 Day out of Valid
WR4 equivalenceclasses and invalid value for range
day.
Enter valid values for day and year 15 13 1992 Month out Valid
WR5 from equivalenceclasses and invalid of range
value for month.
Enter valid values for day and month from 15 6 2016 Year out of Valid
WR6 equivalenceclasses and invalid value for range
year.

Strong Robust

Test Inputs
cases Description Output Comments
DD M YY
M
SR1 Enter valid values for month and -1 6 1992 Day out of Valid
year from equivalenceclasses and range
invalid value for day.
Enter valid values for day and year 15 -1 1992 Month out of Valid
SR2 from equivalenceclasses and invalid range
value for month.
SR3 Enter valid values for day and 15 6 1811 Year out of Valid
month from equivalenceclasses range
and invalid value for year.
SR4 Enter valid value for year from -1 -1 1992 Day, Month out Valid
equivalence classes andinvalid ofrange
values for day and month.
SR5 Enter valid value month for from -1 6 1811 Day, Year out Valid
equivalence classesand invalid of range
values for day and year.
SR6 Enter valid value for day from 15 -1 1811 Month, Year out Valid
equivalence classes andinvalid ofrange
values for month and year.
SR7 Enter valid values for month and 32 6 1992 Day out of Valid
year from equivalenceclasses and range
invalid value for day.
SR8 Enter valid values for day and year 15 13 1992 Month out of Valid
from equivalenceclasses and invalid range
value for month.
SR9 Enter valid values for day and 15 6 2016 Year out of Valid
month from equivalenceclasses range
and invalid value for year.
SR10 Enter valid value for year from 32 13 1992 Day, Month out Valid
equivalence classes andinvalid ofrange
values for day and month.
SR11 Enter valid value month for from 32 6 2016 Day, Year out Valid
equivalence classesand invalid of range
values for day and year.
SR12 Enter valid value for day from 15 13 2016 Month, Year Valid
equivalence classes andinvalid out ofrange
values for month and year.
SR13 Enter invalid values for day, month -1 -1 1811 Day, Month, Valid
and year. Year outof
range
SR14 Enter invalid values for day, month 32 13 2016 Day, Valid
and year. Month,
Year outof
range
Experiment No. 5
Aim: Design and develop a program to solve the triangle problem defined as follows: Accept three
integers which are supposed to be the three sides of a 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.

Program:

#include<stdio.h>
#include<conio.h>
int main()
{
int a,b,c;
printf("enter the sides of triangle\n");
scanf("%d%d%d",&a,&b,&c);
if((a+b)>c && (b+c)>a && (c+a)>b)
{
if(a==b && b==c)
printf("triangle is equilateral\n");
else if (a!=b && b!=c && c!=a)
printf("triangle is scalene\n");
else
printf("triangle is isosceles\n");
}
else
printf("triangle cannot be formed\n");
return 0;
}

INPUT/ OUTPUT

Decision Table for Triangle Problem

R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11

C1: a<b+c F T T T T T T T T T T
Conditions C2: b<c+a -- F T T T T T T T T T

C3: c<a+b -- -- F T T T T T T T T
C4: a=b -- -- -- T T F F F T T F
Actions C5: b=c -- -- -- T F T F F T F T

C6: c=a -- -- -- T F F T F F T T

A1: Not a x x x
triangle
A2: x
Equilateral
A3: x x x
Isosceles
A4: x
Scalene

A5: x x x
Impossible

Test Cases using Decision Table for Triangle Program

Inputs
Testcases Description A B C Output Comments
Case 1 Enter the values of a, b and c such that value of a is 7 2 3 Not a Valid
greaterthan sum of b and c. triangle
Case 2 Enter the values of a, b and c such that value of b is 2 8 3 Not a Valid
greaterthan sum of a and c. triangle
Case 3 Enter the values of a, b and c such that value of c is 2 4 7 Not a Valid
greaterthan sum of a and b. triangle

Case 4 Enter the values of a, b and c such that values of a,b 5 5 5 Equilater Valid
and care equal. al
Case 5 Enter the values of a, b and c Such that value of a is 4 4 3 Isosceles Valid
equalto value of b.
Case 6 Enter the values of a, b and c such that value of b is 2 5 5 Isosceles Valid
equalto value of c.
Case 7 Enter the values of a, b and c such that value of a is 6 2 6 Isosceles Valid
equal tovalue of c.
Case 8 Enter the values of a, b and c such that values of a,b 2 3 4 Scalene Valid
and care different.
Case 9 Enter the values of a, b and c such that value of a is ? ? ? Impossible Valid
equal tovalue of b and c but value of b is not equal to
c.
Enter the values of a, b and c such that value of b is
Case 10 equal to value of c and value of c is equal to a but ? ? ? Impossible Valid
value of a not equalto b.
Enter the values of a, b and c such that value of a is
Case 11 equal to b and value of b is equal to value of c but ? ? ? Impossible Valid
value of a notequal to c.
Experiment No. 6

Aim: Design, develop a code to solve the commission problem. Analyse it from the perspective of decision
tablebased testing, derive different test cases, execute these test cases and discuss the test results.

INPUT DECISION TABLE

RULES R1 R2 R3 R4 R5 R6 R7 R8 R9

Conditions C1: 1<= locks <=70 --- T T T T F F F F


C2: 1<= stocks <=80 --- F T F T F T F T
C3: 1<= barrels <= 90 --- F F T T F F T T
C4: locks = -1 T T T T T T T T T
a1: Invalid lock input X X X X
a2: Invalid stock input X X X X
Actions a3: Invalid barrels input X X X X
a4: Calculate totallocks,
totalstocks and totalbarrels X X X X X X X X X
a5: Calculate sales X X X X X X X X X

Test cases for Commission program for Input Decision table.

Test Descri ption Inputs Expected Comment


cases output s
Lock Stock Barrel Sales Com
s s s
IDT1 Enter no. of locks=-1 -1 - - 0 0 valid
Program
Terminates
IDT2 Enter the valid no. of locks and 20 81 91 900 90 valid
invalid values for stocks and barrels Invalid no.of
stocks and

barrels

IDT3 Enter the valid values for locks, 20 20 96 1500 175 valid
stocks andinvalid value for barrels Invalid no.of barrels
IDT4 Enter the valid values for locks and 20 -1 20 1400 160 valid
barrelsand invalid value for stocks Invalid no.of stocks
IDT5 Enter the valid values for locks, 20 20 20 2000 260 valid
stocks andbarrels Calculates sales and
commission
IDT6 Enter the invalid values for locks, -2 81 -1 0 0 valid
stocks andbarrels Invalid no.of locks,
Stocks andbarrels.
IDT7 Enter the valid value for stocks and -2 20 91 600 60 valid
invalidvalues for locks and barrels Invalid no.of locks
and barrels
IDT8 Enter invalid input for locks and 71 -1 20 500 50 valid
stocks andvalid input for barrels Invalid no.of locks
and stocks
IDT9 Enter the invalid value for locks and -3 20 20 1100 115 valid
validvalues for stocks and barrels Invalid no.of locks

COMMISSION CALCULATION DECISION TABLE

RULES R1 R2 R3

C1: Sales> 1801 T F F


Conditions
C2: Sales >1001 and sales <= 1800 --- T F

C3: Sales <=1000 --- --- T

a1: comm. = 10% *1000 + 15%*800 + (sales-1800) * 20% X


Actions
a2: comm. = 10% *1000 + (sales-1000)* 15% X

a3: comm. = 10% *sales X

Test cases for Commission program for Output Decision table

Test Description Inputs Expected output Comments


cases
Locks Stocks Barrels Sales Com
IDT1 Enter the value of locks,stocks 19 18 18 1845 229 Valid
and Barrelssuch that
sales>1800.
IDT2 Enter the value of locks,stocks 14 14 14 1400 160
and Barrels such that sales>1000 Valid
andsales <=1800.
IDT3 Enter the value of 5 5 5 500 50 Valid
locks,stocks
andBarrels such that
sales<=1000.
Experiment No. 7
Aim: Design, develop a program to solve the commission problem. Analyze it from the perspective of
dataflow testing, derive different test cases, execute these test cases and discuss the test results.

Program:

#include<stdio.h>
#include<conio.h> int main()
{
int c1,c2,c3,temp;
int locks,stocks,barrels,totallocks,totalstocks,totalbarrels;
float lockprice,stockprice,barrelprice,locksales,stocksales,barrelsales,sales,com;
lockprice=45.0;
stockprice=30.0;
barrelprice=25.0;
totallocks=0;
totalstocks=0;
totalbarrels=0;
clrscr();
printf("Enter the number of locks and to exit press -1\n");
scanf("%d",&locks);
while(locks != -1)
{
c1=(locks<=0 || locks>70);
printf("\nEnter 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("\nValue of locks are not in the range of 1. .. 70\n");
else
{
temp=totallocks+locks;
if(temp>70)
printf("New totallocks = %d not in the range of 1 .... 70\n",temp);
else
totallocks=temp;
}
printf("Total locks = %d",totallocks);
if(c2)
printf("\n Value of stocks not in the range of 1 .... 80\n");
else
{
temp=totalstocks+stocks;
if(temp>80)
printf("\nNew total stocks = %d not in the range of 1. .. 80",temp);
else totalstocks=temp;
}
printf("\nTotal stocks = %d",totalstocks); if(c3)
printf("\n Value of barrels not in the range of 1 ... 90\n");
else
{
temp=totalbarrels+barrels; if(temp>90)
printf("\nNew total barrels = %d not in the range of 1 ... 90\n",temp); else
totalbarrels=temp;
}
printf("\nTotal barrels=%d", totalbarrels); printf("\nEnter the number of locks and to exit press -
1\n");
scanf("%d",&locks);
}
printf("\n Total locks = %d",totallocks);
printf("\n Total stocks = %d",totalstocks);
printf("\n Total barrels = %d",totalbarrels);
locksales=totallocks*lockprice;
stocksales=totalstocks*stockprice;
barrelsales=totalbarrels*barrelprice;
sales=locksales+stocksales+barrelsales;
printf("\n Total sales = %f",sales); if(sales>1800)
{ com=0.10*1000; com=com+(0.15*800);
com=com+0.20*(sales-1800);
}
else if(sales>1000)
{
com=0.10*1000;
com=com+0.15*(sales-1000);
}
else com=0.10*sales;
printf("\nCommission = %f",com);
getch();
return 0;
}

Define/ Use Nodes for variables in the commission problem

Variable Defined at node Used at node

lockprice 8 63
stockprice 9 64
barrelprice 10 65

totallocks 11,32 28,34,60,63


totalstocks 12,43 39,45,61,64
totalbarrels 13,54 50,56,62,65
Locks 16,58 17,19,28
stocks 21 22,39
barrels 21 23,50
locksales 63 66
stocksales 64 66
barrelsales 65 66
Sales 66 67,68,72,74,77,80
Com 70,71,72,76,77,80 71,72,77,81

Define /Use paths with definition clear status

Variable
Te Description s DU paths DC
s path
tid (beginnin ?
g ,end
nodes)
Check for lockprice 8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,2
variable 9,
1 DEF(ocklprice,8) <8,63 31,32,33,34,35,37,38,39,40,42,43,44,45,46,48,49 YES
>
And ,50,51,53,54,55,56,57,58,59,60,61,62,63
USE(lockprice,63)
Check for 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,26,
stockprice
2 variable <9,64 27,28,29,31,32,33,34,35,37,38,39,40,42,43,44,45, YES
DEF(stockprice,9) >
And 46,48,49,50,51,53,54,55,56,57,58,59,60,61,62,63,64
USE(stockprice,64)
Check for 10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,
barrelprice
3 variable <10,65 29,31,32,33,34,35,37,38,39,40,42,43,44,45,46, YES
DEF(barrelprice,10) >
And 48,49,50,51,53,54,55,56,57,58,59,60,61,62,63,64,65
USE(barrelprice,65)

<11,28 11,12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28 YES


>

<11,34 11,12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,29,31, NO
> 32,33,34
Check for
totallocks
4 variable NO
<11,60 11,12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,29,31,32,
DEF(totallocks,1 33,34,35,37
>
1,32) ,38,39 ,40,42,43
,44,45,46,48,49,50,51,53,54,55,56,57,58,59,60
And
USE(totallocks,
28,34,60,63) 11,12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,29,31,32,
33,34,35,37
<11,63 ,38,39 ,40,42,43 NO
> ,44,45,46,48,49,50,51,53,54,55,56,57,58,59,60,61,62,63
32,33,34,35,37,38,39,40,42,43,44,45,46,48,49,50,51,53,54,55, YES
<32,28
56,57,58,17
>
,18,19,20,21,22,23,24,26,27,28
YES
<32,34> 32,33,34
<32,60> 32,33,34,35,37,38,39,40,42,43,44,45,46,48,49,50,51, YES
53,54, 55,56,57,58,59, 60
<32,63> 32,33,34,35,37,38,39,40,42,43,44,45,46,48,49,50,51
, 53,54,55,56,57,58,59 ,60,61,62,63 YES
<12,39 12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,29,31,3 YES
> 2,33,34,35,37,38,39
<12,45 12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,29 NO
>
,31,32,33,34,35,37,38,39,40,42,43,44,45

Check for <12,61 12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,29


totalstocks variable > ,31,32,33,34,35,37,38,39,40,42,43,44,45,46,48,49 NO
DEF(totalstocks,12,
5 43) ,50,51,53,54,55,56,57,58,59,60,61
And
USE(totalstocks,
12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,29
<12,64 NO
,31,32,33,34,35,37,38,39,40,42,43,44,45,46,48,49
>
,50,51,53,54,55,56,57,58,59,60,61,62,63,64
<43,45 YES
> 43,44,45

YES
<43,61> 43,44,45,46,48,49,50,51,53,54,55,56,57,58,59,60,61

YES
<43,64> 43,44,45,46,48,49,50,51,53,54,55,56,57,58,59,60,61,62,6
3,64

<13,50> 13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,29 YES


,31,32,33,34,35,37,38,39,40,42,43,44,45,46,48,49,50

<13,56> 13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,29 NO
,31,32,33,34,35,37,38,39,40,42,43,44,45,46,48,49
,50,51,53,54,55,56

<13,62> NO
Check for
13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,29,
totalbarrels
variable 31,32,33,34,35,37,38,39,40,42,43,44,45,46,48,49,
6 DEF(totalbarrels,1
50,51,53,54,55,56,57,58,59,60,61,62
3,54)

And
USE(totalbarrels,
50,56,62,65) <13,65> 13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,29,
31,32,33,34,35,37,38,39,40,42,43,44,45,46,48,49, NO
50,51,53,54,55,56,57,58,59,60,61,62,63,64,65

<54,56> 54,55,56 YES

<54,62> 54,55,56,57,58,59,60,61,62 YES

<54,65> 54,55,56,57,58,59,60,61,62,63,74,65 YES


<16,17> 16,17 YES
<16,19> 16,17,18,19 YES
Check for locks
<16,28> 16,17,18,19,20,21,22,23,24,26,27,28 YES
7 variable
DEF(locks,16,58) <58,17> 58,17 YES
And <58,19> 58,17,18,19 YES
USE(locks,17,19,28 <58,28> 58,17,18,19,20,21,22,23,24,26,27,28 YES
)
Check for stocks <21,22> 21,22 YES
8 variable <21,39> 21,22,23,24,26,27,28,29,31,32,33,34,35,37,38,39 YES
DEF(stocks,21)
And
USE(stocks,22,39)
Check for barrels <21,23> 21,22,23
9 variable <21,50> 21,22,23,24,25,26,27,28,29,31,32,33,34,35,37,38,39,40,4 YES
DEF(barrels,21) 2,43,44,45,
And 46,47,48,49,50
USE(barrels,23,50)
Check for
10 lockpsales <63,66> 63,64,65,66 YES
variable
DEF(locksales,63
)
And
USE(locksales,66)

Check for
11 stocksales variable <64,66> 64,65,66 YES
DEF(stocksales,64
)
And
USE(stocksales,66)
Check for
12 barrelsales <65,66> 65,66 YES
variable
DEF(barrelsales,6
5)
And
USE(barrelsales,66)
Check for sales <66,67> 66,67 YES
variable <66,68> 66,67,68 YES
1 DEF(sales,66)
<66,72> 66,67,68,69,70,71,72 YES
3 And
YES
USE(sales,67,68,72, <66,74> 66,67,68,74
74,77,8 0) <66,77> 66,67,68,74,75,76,77 YES
<66,80> 66,67,68,74,79,80 YES
<70,71> 70,71 NO
<70,72> 70,71,72 NO
<70,81> 70,71,72,73,81
<71,72> 71,72 NO
<71,81> 71,72,73,81 NO
14 <72,81> 72,73,81
NO
<76,77> 76,77
Check for <76,81> 76,77,78,81 YES
commission <77,81> 77,78,81 NO
variable <80, 80,81
81> NO
DEF(com,70,71,72,
76,77,8 0) YES
And Y
USE(com,71,72,77, E
81)
S
Note
In above Du-Paths, some paths like
<70,77>,<71,71>,<71,77>,<72,71>,<72,72>,<72,77>,<76,71>,<76,72>,<77,71>,<77, 71>,<77,77>,
<80,70>,<80,72>,<80,77>,<80,77> are not possible to be formed. So they are not considered in above table.
Experiment No. 8
Aim: Design, develop a code 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.

Program:
#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;
elseif(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 up to max of 20");
scanf("%d",&n);
if(n>0)
{
printf("enter the elements in ascending order\n");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
printf("enter the key element to be searched\n");
scanf("%d",&key);
succ=binsrc(a,0,n-1,key);
if(succ>=0)
printf("Element found in position = %d\n",succ+1);
else
printf("Element not found \n");
}
else
printf("Number of element should be greater than zero\n");
return 0; }

Program Graph

1 2 3 4

1
4
7

8 9

1
1 1
5 1
0

1
2

1
3
McCabe’s Basis path method
Considering DD-Path graph of the program, first we need to find Baseline path. A baseline path consists of
maximum number of decision nodes. Using Baseline path we start flipping each decision node for finding
newpaths. Considering Binary search program

Baseline Path: A B C D E F H B J K.

Nodes which are bold and large are decision nodes. Now start flipping each decision node.

Flipping at B : A B J K.

Flipping at D : A B C D I K.

Flipping at E : A B C D E G H B J.

Cyclomatic Complexity

V(G) =e-n+2p

Where, e is number of edges in DD-Path graph. n is


number of nodes in DD-Path graph. p is number
of regions connected.(always 1)
Number of linearly independent paths for a given
graph G = 13-11+2(1)= 4 Test cases

Test Cases for Binary Search Program

Test Input
Cases Description N Array elements Key Expected Comment
Output

Infeasible
TC1 Enter the basis because Valid
2 {5,10} 4
path consisting low>high
1 {10} 5
ofall decision means from B
nodes to J
ABCDEFHBJK. then K which
means no
elements left
which is not
true in any
case.
0 Infeasible
Enter the basis because
TC2 path --------- ---- low>high Invalid
consisting means from B
ofall decision to J then K
nodes ABJK. which means
no elements
left which
isnot true in
any case.

Enter the basis 2 {5,10} 10 Element


TC3 path consisting 3 {5,10,15} 10 found in Valid
ofall decision 5 {5,10,15,20,25} 15 position 2
nodes Element
ABCDIK. found in
position 2
Element
found in
position 3
2 {5,10} 15 Infeasible
TC4 Enter the basis path 1 {10} 12 because Invalid
consisting ofall low>high
decision nodes means from B
ABCDEGHBJK. to J then K
which means
no elements
left which is
not true in any
case.
Experiment No. 9

Aim: Design, develop a code to implement the Quicksort algorithm. Determine the basis paths and using
them derive different test cases, execute these test cases and discuss the test results.

Program:

#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--;
K. 15 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);
}
}

int main()
{
int a[20],i,key,n; printf("enter the size of the array max
of 20 elements");
scanf("%d",&n); if(n>0)
{
printf("enter the elements of the array");
for(i=0;i<n;i++)
scanf("%d",&a[i]); quicksort(a,0,n-1);
printf("the elements in the sorted array is:\n");
for(i=0;i<n;i++) print f("%d\t",a[i]);
}
else
printf(“size of array is
invalid\n”);
}

Cyclomatic Complexity

V(G) =e-n+2p
Or
V(G) =e-n+p (for closed closed graph)Where, e is number of edges in DD-Path graph. n is number of
nodes in DD-Path graph. p is number of regions connected.(always 1)
Number of linearly independent paths (Test cases) for a given graph G = 23-17+(1)
= 6+1
= 7 Test cases

Program graph
DD path graph

NODES DDPATHS
1 A
2-3 B
4 C
5-8 D
9 E
10 F
11 G
12 H
13 I
14 J
15 K
16-20 L
21 M
22-25 N
26 P
27 Q
28 O

McCabe’s Basis path method


Considering DD-Path graph of the program, first we need to find Baseline path. A baseline path consists
of maximum number of decision nodes. Using Baseline path we start flipping each decision node for finding
newpaths.

Considering Quick Sort program


Considering DD-Path graph of Quick sort function, function starts at node A and Ends at node O. First,
BaseLine path is formed by considering all decision nodes as shown below.

Baseline Path: A BC DE FG I K M E N A B C O P A B C O.

Nodes which are bold and large are decision nodes. Now start flipping each decision node.
Flipping at C : A B C O.
Flipping at E : A B C D E N A B C O.
Flipping at G : A B C D E F G H G I K M E N A B C O.

Flipping at I :A B C D E F G I J I K M E N A B C O.

Flipping at K : A B C D E F G I K L M E N A B C O.

Flipping at P :A B C D E F G I K L M E N A B C O P A B C O.

Test Cases for Quick Sort Program

Test Number of
Cases Description elements Array Elements Comment
(n)
Enter the basis path consisting of all Infeasible because path
TC1 decisionnodes ---- from G to I meansno Invalid
ABCDEFGIKMENABCOPABCO. elements in array.
Enter the basis path consisting of all
TC2 1 {9} Valid
decisionnodes ABCO.
Path C to D indicates
Enter the basis path consisting of all ---- if(first<last) is condition Invalid
TC3 decisionnodes ABCDENABCO. is true. So at first iteration
while(x[i]<=x[pivot]&&i
< last) condition also
should be true and path E
to F should be present.
But we have
EN so Infeasible
Enter the basis path consisting of all
TC4 decisionnodes 2 {5,4 } Valid
ABCDEFGHGIKMENABCO.

Enter the basis path consisting of all Infeasible because


TC5 decisionnodes ---- path from G to I
Invalid
ABCDEFGIJIKMENABCO. meansno elements in
array.
Enter the basis path consisting of all Infeasible because
TC6 decisionnodes ---- path from G to I
Invalid
ABCDEFGIKLMENABCO. meansno elements in
array.
Enter the basis path consisting of all Infeasible because
TC7 decision nodes ---- path from G to I
Invalid
ABCDEFGIKLMENABCOPABCO. meansno elements in
array.

Note

If given array contains a single element, then first=last, if(first<last) condition is true indicates there are
more than one elements in the given array. Even when there will be single element
While(x[i]<=x[pivot]&&i<last) conditionwill get executed at least once, because x[i]=x[pivot] is also
considered. So path there should be one path G to H present for any feasible solution. So in above table
paths containing G to I are all infeasible.
Experiment No.10
Aim: Design, develop a code to implement an absolute letter grading procedure, making suitable
assumptions. Determine the basis paths and using them derive different cases, execute these test cases and
discuss the test results.

Program:
#include<stdio.h>
#include<conio.h>
int main()
{
float per; char grade;
printf("enter the percentage\n");
scanf("%f",&per);
if(per>=90) grade='a';
else if((per>=80) && (per<90))
grade='b';
else if((per>=70) && (per<80))
grade='c';
else if((per>=60) && (per<70))
grade='d';
else grade='e';
switch(grade)
{
case 'a':
printf("excellent\n");
break;
case 'b':
printf("very good\n");
break;
case 'c':
printf("good\n");
break;
case 'd':
printf("above average\n");
break;
case 'e':
printf("satisfactory\n");
break;
}
printf("the percentage is %f and the grade is %c\n",per,grade);
return 0;
}
Cyclomatic Complexity

V(G) =e-n+2p

Where, e is number of edges in DD-Path graph. n is number of nodes in DD-Path graph. p is


number of regions connected.(always 1)
Number of linearly independent paths (Test cases) for a given graph G = 26-19+2(1)

= 7+2

= 9 Test cases

Program graph
DD path graph

Nodes DD-Paths

1-6 A

7 B

8 C

9 D

10 E

11 F

12 G

13 H

14 I

15 J

16 K

17 L

18-19 M

20-21 N

22-23 O

24-25 P

26-27 Q

28 R

29-31 S

Finding Basis paths for Letter Grading program using McCabe’s method
Considering DD-Path graph of Absolute Letter grading program, Baseline path is formed by
considering alldecision nodes as shown below.
Baseline Path: AB D F H J K L M R S.

Nodes which are bold and large are decision nodes. Now start flipping each decision node.

Flipping at B : A B C K L M R S.
Flipping at D : A B D E K L M R S.
Flipping at F : A B D F G K L M R S.
Flipping at H : A B D F H I K L M R S.
Flipping at L : A B D F H J K L N R S.
A B D F H J K L O R S.
A B D F H J K L P R S.
A B D F H J K L Q R S.
Test Cases for Letter Grading Program

Test Description Input Expected Comment


ID Output
Actual Output
TC1 Enter the basis path Node J indicates grade „e‟ so
containing 55 Satisfactory case „e‟ should be executed Invalid
thedecision nodes i.e., node Q. but there is no Q
ABDFHJKLMRS in this path so Infeasible
TC2 Enter the basis path
containing 95 Excellent Excellent Valid
thedecision
nodes ABCKLMRS
TC3 Enter the basis path Node E indicates grade „b‟ so
containing 85 Very good case Invalid
thedecision „b‟ should be executed i.e.,
nodes node N. but there is no N in
ABDEKLMRS this path so Infeasible
TC4 Enter the basis path Node F indicates grade „c‟
containing 75 Good so case „c‟ should be Invalid
thedecision nodes executed i.e., node O. but
ABDFGKLMRS there is no O in this path so
Infeasible

TC5 Enter the basis path Node H indicates grade „d‟ so


containing 65 Above case „d‟ should be executed Invalid
thedecision nodes average i.e., node P.
ABDFHIKLMRS but there is no P in this path so
Infeasible
TC6 Enter the basis path Node J indicates grade „e‟ so
containing 55 Satisfactory case „e‟ should be executed Invalid
thedecision nodes i.e., node Q. but there is no Q
ABDFHJKLNRS in this path so Infeasible
Enter the basis path Node J indicates grade „e‟ so
TC7 containing 55 Satisfactory case „e‟ should be executed Invalid
thedecision nodes i.e., node Q. but there is no Q
ABDFHJKLORS in this path so Infeasible
TC8 Enter the basis path Node J indicates grade „e‟ so
containing 55 Satisfactory case „e‟ should be executed Invalid
thedecision nodes i.e., node Q. but there is no Q
ABDFHJKLPRS in this path so Infeasible
Enter the basis path
TC9 containing 55 Satisfactory Satisfactory Valid
thedecision nodes
ABDFHJKLQRS

In above table we got test cases containing only Excellent and satisfactory type outputs. As we have five
typesof outputs in our program, three types of outputs (i.e., good, very good and above average) are left
untested. So for completeness we add three more tests for left out cases as shown below.

Enter the basis path containing the


TC10 decision nodes 85 Very Very Valid
ABDEKLNRS good good
TC11 Enter the basis path containing the
decision nodes 75 Good Good Valid
ABDFGKLORS
Enter the basis path containing the
TC12 decision nodes 65 Above Above Valid
ABDFHIKLPRS average average

You might also like