0% found this document useful (1 vote)
4K views97 pages

18isl66-Software Testing Manual

This document contains information about a software testing laboratory course for the Department of Information Science and Engineering at a university. It includes the course objectives, list of experiments to be completed in the laboratory, prerequisites, and details about designing, developing, and implementing algorithms to solve problems using programming languages under Linux/Windows environments. Students will analyze problems, derive test cases using different testing techniques, implement solutions, and discuss test results.

Uploaded by

King Khan
Copyright
© © All Rights Reserved
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 (1 vote)
4K views97 pages

18isl66-Software Testing Manual

This document contains information about a software testing laboratory course for the Department of Information Science and Engineering at a university. It includes the course objectives, list of experiments to be completed in the laboratory, prerequisites, and details about designing, developing, and implementing algorithms to solve problems using programming languages under Linux/Windows environments. Students will analyze problems, derive test cases using different testing techniques, implement solutions, and discuss test results.

Uploaded by

King Khan
Copyright
© © All Rights Reserved
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
You are on page 1/ 97

Affiliated to VTU, Belagavi | Approved by AICTE | Accredited by NBA and NAAC | Recognized by UGC with (2(f) & 12(B)

Status

DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING

VI SEMESTER
ACADEMIC YEAR 2020–2021 [EVEN]
Software Testing Laboratory

18ISL66
LABORATORY MANUAL

NAM E OF THE STUDENT :

BRANCH :

UNIVERSITY SEAT NO. :

SEMESTER & SECTION : VI


BATCH :

Prepared by:
Prof. LATHA S S (AP, DEPT OF ISE_MVJCE)
DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING

Institute Vision

To become an institute of academic excellence with international standards.

Institute Mission

 Impart quality education along with industry exposure.


 Provide world class facilities to undertake research activities relevant to
industrial and professional needs.
 Promote entrepreneurship and value added education that is socially
relevant with economic benefits

Department Vision

To be recognized as a department of repute in Information Science and Engineering by adopting quality


teaching learning process and impart knowledge to make students equipped with capabilities required
for professional, industrial and research areas to serve society.

Department Mission

 Innovation and technically competent: To impart quality education in Information Science


and Engineering by adopting modern teaching learning processes using innovation
techniques that enable them to become technically competent.
 Competitive Software Professionals: Providing training Programs that bridges gap between
industry and academia, to produce competitive software professionals.
 Personal and Professional growth: To provide scholarly environment that enables value
addition to staff and students to achieve personal and profession growth.

Program Outcomes (PO):

1. Engineering knowledge: Apply the knowledge of mathematics, science, engineering


fundamentals, and an engineering specialization to the solution of complex engineering problems.
2. Problem analysis: Identify, formulate, research literature, and analyze complex engineering
problems reaching substantiated conclusions using first principles of mathematics, natural
sciences, and engineering sciences.
3. Design / development of solutions: Design solutions for complex engineering problems and
design system components or processes that meet the specified needs with appropriate
consideration for the public health and safety, and the cultural, societal, and environmental
considerations.
4. Conduct investigations of complex problems: Use research-based knowledge and research
methods including design of experiments, analysis and interpretation of data, and synthesis of the
information to provide valid conclusions.
5. Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern
engineering and IT tools including prediction and modeling to complex engineering activities
with an understanding of the limitations.
6. The engineer and society: Apply reasoning informed by the contextual knowledge to assess
societal, health, safety, legal and cultural issues and the consequent responsibilities relevant to the
professional engineering practice.
7. Environment and sustainability: Understand the impact of the professional engineering
solutions in societal and environmental contexts, and demonstrate the knowledge of, and need for
sustainable development.
8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and
norms of the engineering practice.
9. Individual and team work: Function effectively as an individual, and as a member or leader in
diverse teams.
10. Communication: Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend and write
effective reports and design documentation, make effective presentations, and give and receive
clear instructions.
11. Project management and finance: Demonstrate knowledge and understanding of the
engineering and management principles and apply these to one’s own work, as a member and
leader in a team, to manage projects and in multidisciplinary environments.
12. Life-long learning: Recognize the need for, and have the preparation and ability to engage in
independent and life-long learning in the broadest context of technological change.

Program Educational Objectives (PEOs):

 IT Proficiency: Graduates will excel as IT Experts with extensive knowledge to analyze and
design solutions to Information Engineering problems.
 Social &moral principles: Graduates will work in a team, showcase professionalism; ethical
values expose themselves to current trends and become responsible Engineers.
 Higher education: Graduates will pursue higher studies with the sound knowledge of
fundamental concepts and skills in basic sciences and IT disciplines.

Program Specific Outcomes (PSO):

PSO1. Software professional expertise: An ability to understand, analyze and develop computer
programs in the areas related to algorithms, system software, multimedia, web design,
DBMS, and networking for efficient design of computer-based systems of varying
complexity.

PSO2. Core competence: An ability to compete practically to provide solutions for real world
problems with a broad range of programming language and open source platforms in various
computing domains
Course outcomes (CO):
On the completion of this laboratory course, the students will be able to:

 List out the requirements for the given problem


 Design and implement the solution for given problem in any programming
language(C,C++,JAVA)
 Derive test cases for any given problem
 Apply the appropriate technique for the design of flow graph.
 Create appropriate document for the software artefact

Prerequisites:
 Knowledge about C and C++ Programming.
SOFTWARE TESTING LABORATORY
SEMESTER – VI
Sub. Code: 18ISL66 CIE Marks: 40
Hrs/Week : 0:2:2 Exam Hours: 03
Total Hours: 36 SEE Marks: 60

Course objectives:
This course will enable students to
 Analyse the requirements for the given problem statement
 Design and implement various solutions for the given problem
 Employ various design strategies for problem solving.
 Construct control flow graphs for the solution that is implemented
 Create appropriate document for the software artifact.

Design, develop, and implement the specified algorithms for the following problems using any
language of your choice under LINUX /Windows environment.

LIST OF EXPERIMENTS

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
1. 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.
Design, develop, code and run the program in any suitable language to solve the commission
2. problem. Analyze it from the perspective of boundary value testing, derive different test cases,
execute these test cases and discuss the test results.
Design, develop, code and run the program in any suitable language to implement the Next Date
3. function. Analyze it from the perspective of boundary value testing, derive different test cases,
execute these test cases and discuss the test results
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
4. 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 equivalence class partitioning, execute the test cases and discuss the results
Design, develop, code and run the program in any suitable language to solve the commission
5. problem. Analyze it from the perspective of equivalence class testing, derive different test cases,
execute these test cases and discuss the test results.
Design, develop, code and run the program in any suitable language to implement the Next Date
6. function. Analyze it from the perspective of equivalence class value testing, derive different test
cases, execute these test cases and discuss the test results.
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
7. 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.
Design, develop, code and run the program in any suitable language to solve the commission
8. problem. Analyze it from the perspective of decision table-based testing, derive different test cases,
execute these test cases and discuss the test results.
Design, develop, code and run the program in any suitable language to solve the commission
9. problem. Analyze it from the perspective of dataflow testing, derive different test cases, execute these
test cases and discuss the test results
Design, develop, code and run the program in any suitable language to implement the binary search
10. algorithm. Determine the basis paths and using them derive different test cases, execute these test
cases and discuss the test results.
Design, develop, code and run the program in any suitable language to implement the quick sort
11. algorithm. Determine the basis paths and using them derive different test cases, execute these test
cases and discuss the test results.
Design, develop, code and run the program in any suitable language to implement an absolute letter
12. grading procedure, making suitable assumptions. Determine the basis paths and using them derive
different test cases, execute these test cases and discuss the test results

Content beyond Syllabus

Take any system (e.g. ATM system)and study its system specifications and report the
13
various bugs.
14 Study of any web testing tool (e.g. Selenium)

Conduction of Practical Examination:

All laboratory experiments, excluding the first, are to be included for practical examination.
• Experiment distribution
o For questions having only one part: Students are allowed to pick one experiment from the lot
and are given equal opportunity.
o For questions having part A and B: Students are allowed to pick one experiment from part A
and one experiment from part B and are given equal opportunity.
• Change of experiment is allowed only once and marks allotted for procedure part to be made zero.
• Marks Distribution (Courseed to change in accordance with university regulations)
m) For questions having only one part – Procedure + Execution + Viva-Voce: 15+70+15 = 100
Marks
n) For questions having part A and B
i. Part A – Procedure + Execution + Viva = 4 + 21 + 5 = 30 Marks
ii. Part B – Procedure + Execution + Viva = 10 + 49+ 11 = 70 Marks
Program 1: Triangle Problem
Testing Technique:Boundary Value Analysis
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 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.
#
i
n
c
l
u
d
e
<
s
t
d
i
o
.
h
>

i
n
t

m
a
i
n
(

)
{
i
n
t

a
,
b
,
c
,
c
1
,
c
2
,
c
3
;

d
o
{
p
r
i
n
t
f
(
"
e
n
t
e
r

t
h
e

s
i
d
e
s

o
f

t
r
i
a
n
g
l
e
\
n
"
)
;

s
c
a
n
f
(
"
%
d
%
d
%
d
"
,
&
a
,
&
b
,
&
c
)
;
c1=((a>=1) && (a<=10));
c2=((b>=1) && (b<=10));
c3=((c>=1) && (c<=10));
if(!c1)
p
r
i
n
t
f
(
"
v
a
l
u
e

o
f

i
s

o
u
t

o
f

r
a
n
g
e
"
)
;

i
f
(
!
c
2
)
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");
return 0;
}
Boundary Value Analysis
Boundary value analysis focuses on the boundary of the input and output space to identify test cases because errors tend to occur near the
extreme values of an input variable. The basic idea is to use input variables at their minimum, just above minimum, nominal, just below their
maximum and maximum.

Considering Triangle program, we have three variables a, b and c. Each variables value ranges from 1 to 10.

Variables Min Min+ Nom Max- Max


a 1 2 5 9 10
b 1 2 5 9 10
c 1 2 5 9 10

Boundary Value Analysis = 4n+1 test cases, where n is number of variables


In Triangle program for BVA, we start by taking nominal values for a and b variables then cross product it with values min, min-, nom, max-
and max values of variable c. similarly keeping nominal values for variables a and c, we cross product it with min, min-, nom, max-, max
values of variable b. Again keeping variable b and c as nominal combine with 5 values of a. By this we get 15 te st cases in which a test case
with all nominal values for a, b and c is repeated thrice, so we discard 2 duplicate such cases and finally we get 15-2=13 test cases which is
equal to BVA i.e., 4(3)+1=13.
Test cases using Boundary value analysis for Triangle Program

Inputs
Test
Description Output Comments
cases A B C

BVA1 Enter the values of a(nom),b(nom) and c(min) 5 5 1 Isosceles Valid

BVA 2 Enter the values of a(nom),b(nom) and c(min+) 5 5 2 Isosceles Valid

BVA 3 Enter the values of a(nom),b(nom) and c(nom) 5 5 5 Equilateral Valid

BVA 4 Enter the values of a(nom),b(nom) and c(max-) 5 5 9 Isosceles Valid

BVA 5 Enter the values of a(nom),b(nom) and c(max) 5 5 10 Triangle cannot be formed Valid

BVA 6 Enter the values of a(nom),b(min) and c(nom) 5 1 5 Isosceles Valid

BVA 7 Enter the values of a(nom),b(min+) and c(nom) 5 2 5 Isosceles Valid

BVA 8 Enter the values of a(nom),b(max-) and c(nom) 5 9 5 Isosceles Valid

BVA 9 Enter the values of a(nom),b(max) and c(nom) 5 10 5 Triangle cannot be formed Valid

BVA 10 Enter the values of a(min),b(nom) and c(nom) 1 5 5 Isosceles Valid

BVA 11 Enter the values of a(min+),b(nom) and c(nom) 2 5 5 Isosceles Valid

BVA 12 Enter the values of a(max-),b(nom) and c(nom) 9 5 5 Isosceles Valid

BVA 13 Enter the values of a(max),b(nom) and c(nom) 10 5 5 Triangle cannot be formed Valid
Program 2: Commission Problem
Testing Technique: Boundary Value Analysis

Design, develop, code and run the program in any suitable language to solve the commission problem. Analyse it
from the perspective of boundary value testing, derive different test cases, execute these test cases and discuss the
test results.
#include<stdio.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)
{
c
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); prin tf("\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);
return 0;
}
Considering Commission program, we have three input variables lock, stock and barrels.

Range of value for locks= 1-70, stocks= 1-80 and barrels= 1-90

Variables Min Min+ Nom Max- Max


locks 1 2 35 69 70
stocks 1 2 40 79 80
barrels 1 2 45 89 90

Considering output variable sales we have 3 slots for calculating commission. i.e., if sales are below 1000, com is 10%, if sales are 1001 to
1800 then com is 15% and if sales are greater than 1801, com is 20%.

Sales Min Min+ Nom Max- Max


locks, stocks, barrrels locks, stocks, barrrels locks, stocks, barrrels locks, stocks, barrrels locks, stocks, barrrels

2,1,1 9,10,10
1-1000 1,1,1 1,2,1 5,5,5 10,9,10 10,10,10
1,1,2 10,10,9
11,10,10 12,10,10 17,18,18
1001-1800 10,11,10 10,12,10 14,14,14 18,17,18 18,18,18
10,10,11 10,10,12 18,18,17
19,18,18 20,18,18 69,80,90
1801- above 18,19,18 18,20,18 48,48,48 70,79,90 70,80,90
18,18,19 18,18,20 70,80,89
Test cases for commission program using INPUT Boundary value analysis
Test Inputs Output Comm
cases
Description ents
Locks Stocks Barrels Sales Com
BVA1 Enter the values for locks(nom), stocks(nom) and barrels(min) 35 40 1 2800 420 Valid

BVA2 Enter the values for locks(nom), stocks(nom) and barrels(min+) 35 40 2 2825 425 Valid

BVA3 Enter the values for locks(nom), stocks(nom) and barrels(nom) 35 40 45 3900 640 Valid

BVA4 35 40 89 5000 860 Valid


Enter the values for locks(nom), stocks(nom) and barrels(max-)

BVA5 35 40 90 5025 865 Valid


Enter the values for locks(nom), stocks(nom) and barrels(max)

BVA6 35 1 45 2730 406 Valid


Enter the values for locks(nom), stocks(min) and barrels(nom)

BVA7 Enter the values for locks(nom), stocks(min+) and barrels(nom) 35 2 45 2760 412 Valid

BVA8 35 79 45 5070 874 Valid


Enter the values for locks(nom), stocks(max-) and barrels(nom)

BVA9 35 80 45 5100 880 Valid


Enter the values for locks(nom), stocks(max) and barrels(nom)

BVA10 Enter the values for locks(min), stocks(nom) and barrels(nom) 1 40 45 2370 334 Valid

BVA11 Enter the values for locks(min+), stocks(nom) and barrels(nom) 2 40 45 2415 343 Valid

BVA12 Enter the values for locks(max-), stocks(nom) and barrels(nom) 69 40 45 5430 946 Valid

BVA13 Enter the values for locks(max), stocks(nom) and barrels(nom) 70 40 45 5475 955 Valid
Test cases for commission program using OUTPUT Boundary value analysis

Test Inputs Output Comm ents


Description
cases Locks Stocks Barrels Sales Com
Enter the values for locks(min), stocks(min) and
BVA1 barrels(min) for the range 100 to 1000 1 1 1 100 10 Valid
Enter the values for locks(min+), stocks(min) and
BVA2 barrels(min) for the range 100 to 1000 2 1 1 145 14.5 Valid

Enter the values for locks(min), stocks(min+) and barrels(min)


BVA3
for the range 100 to 1000
1 2 1 130 13 Valid

Enter the values for locks(min), stocks(min) and


BVA4 barrels(min+) for the range 100 to 1000 1 1 2 125 12.5 Valid
Enter the values for locks(nom), stocks(nom) and
BVA5 barrels(nom) for the range 100 to 1000 5 5 5 500 50 Valid
Enter the values for locks(max-), stocks(max) and
BVA6 barrels(max) for the range 100 to 1000 9 10 10 955 95.5 Valid
Enter the values for locks(max), stocks(max-) and
BVA7 barrels(max) for the range 100 to 1000 10 9 10 970 97.0 Valid
Enter the values for locks(max), stocks(max) and
BVA8 barrels(max-) for the range 100 to 1000 10 10 9 975 97.5 Valid
Enter the values for locks(max), stocks(max) and
BVA9 barrels(max) for the range 100 to 1000 10 10 10 1000 100 Valid
Enter the values for locks(min), stocks(min) and
BVA10 barrels(min) for the range 1000 to 1800 11 10 10 1045 106.75 Valid
Enter the values for locks(min), stocks(min+) and barrels(min)
BVA11
for the range 1000 to 1800
10 11 10 1030 104.5 Valid
Enter the values for locks(min), stocks(min) and
BVA12 barrels(min+) for the range 1000 to 1800 10 10 11 1025 103.75 Valid
Enter the values for locks(min+), stocks(min) and
BVA13 barrels(min) for the range 1000 to 1800 12 10 10 1090 113.5 Valid
Enter the values for locks(min), stocks(min+) and
BVA14 barrels(min) for the range 1000 to 1800 10 12 10 1060 109 Valid
Enter the values for locks(min), stocks(min) and
BVA15 barrels(min+) for the range 1000 to 1800 10 10 12 1050 107.5 Valid
Enter the values for locks(nom), stocks(nom) and
BVA16 barrels(nom) for the range 1000 to 1800 14 14 14 1400 160 Valid
Enter the values for locks(max-), stocks(max) and
BVA17 barrels(max) for the range 1000 to 1800 17 18 18 1755 213.25 Valid
Enter the values for locks(max), stocks(max-) and
BVA18
barrels(max) for the range 1000 to 1800
18 17 18 1770 215.5 Valid
Enter the values for locks(max), stocks(max) and
BVA19 barrels(max-) for the range 1000 to 1800 18 18 17 1775 216.25 Valid
Enter the values for locks(max), stocks(max) and
BVA20 barrels(max) for the range 1000 to 1800 18 18 18 1800 220 Valid
Enter the values for locks(min), stocks(min) and
BVA21 barrels(min) for the range > 1800 19 18 18 1845 229 Valid
Enter the values for locks(min), stocks(min) and
BVA22 barrels(min) for the range > 1800 18 19 18 1830 226 Valid
Enter the values for locks(min), stocks(min) and
BVA23
barrels(min) for the range > 1800
18 18 19 1825 225 Valid
Enter the values for locks(min+), stocks(min) and
BVA24 barrels(min) for the range > 1800 20 18 18 1890 238 Valid
Enter the values for locks(min), stocks(min+) and
BVA25 barrels(min) for the range > 1800 18 20 18 1860 232 Valid
Enter the values for locks(min), stocks(min) and
BVA26 barrels(min+) for the range > 1800 18 18 20 1850 230 Valid
Enter the values for locks(nom), stocks(nom) and
BVA27 barrels(nom) for the range > 1800 48 48 48 4800 820 Valid
Enter the values for locks(max-), stocks(max) and
BVA28
barrels(max) for the range > 1800
69 80 90 7755 1411 Valid
Enter the values for locks(max), stocks(max-) and
BVA29 barrels(max) for the range > 1800 70 79 90 7770 1414 Valid
Enter the values for locks(max), stocks(max) and
BVA30 barrels(max-) for the range > 1800 70 80 89 7775 1415 Valid
Enter the values for locks(max), stocks(max) and
BVA31 barrels(max) for the range > 1800 70 80 90 7800 1420 Valid
Program 3: Next date program
Testing Technique: Boundary Value Analysis

Design, develop, code and run the program in any suitable language 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.

#include<stdio.h>
int check(int day,int month)

else

return 0;

if((month==4||month==6||month==9 ||month==11) && day==31) return 1;

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
break;
case 4:
case 6:
case 9:
case 11: if(day<30)
tomm_day=day+1;
else
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;
}

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
Description Output Comments
cases DD MM YY

BVA1 Enter the values for day(nom),month(nom) and year(min)


15 6 1812 16/6/1812 Valid

BVA2 Enter the values for day(nom),month(nom) and year(min+) 15 6 1813 16/6/1813 Valid

BVA 3 Enter the values for day(nom),month(min) and year(nom) 15 6 1914 16/6/1914 Valid
Enter the values for day(nom),month(nom) and year(max-)
BVA4 15 6 2014 16/6/2014 Valid
Enter the values for day(nom),month(nom) and year(max)
BVA5 15 6 2015 16/6/2015 Valid

BVA6 Enter the values for day(nom),month(min) and year(nom) 15 1 1914 16/1/1914 Valid

BVA7 Enter the values for day(nom),month(min+) and year(nom) 15 2 1914 16/2/1914 Valid

BVA8 Enter the values for day(nom),month(max-) and year(nom) 15 11 1914 16/11/1914 Valid

BVA9 Enter the values for day(nom),month(max) and year(nom) 15 12 1914 16/12/1914 Valid

BVA10 Enter the values for day(min),month(nom) and year(nom) 1 6 1914 2/6/1914 Valid

BVA11 Enter the values for day(min+),month(nom) and year(nom)


2 6 1914 3/6/1914 Valid

BVA12 Enter the values for day(max-),month(nom) and year(nom) 30 6 1914 1/7/1914 Valid
Day out of range for
BVA13 Enter the values for day(max),month(nom) and year(nom) 31 6 1914 the month
Valid
Program 4: Triangle Problem
Testing Technique: Equivalence Class 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 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.
#include<stdio.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");
return 0;
}
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 Comments
A B C output
Enter the valid values for a, b and c from output equivalence
WN/SN1 classes.
5 5 5 Equilateral Valid

Enter the valid values for a, b and c from output equivalence


WN/SN2 classes.
5 5 3 Isosceles Valid

Enter the valid values for a, b and c from output equivalence


WN/SN3 classes.
5 3 4 Scalene Valid

Enter the valid values for a, b and c from output equivalence Triangle cannot be
WN/SN4 classes.
10 1 1 formed
Valid
Weak Robust

Test Inputs Expected


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

Strong Robust

Test Inputs Expected


Description Comments
cases A B C output
Enter the valid value for b from output equivalence classes and Values of a and c are Triangle cannot be
SR 1 invalid values for a and c.
-1 3 -1 not in range formed
Enter the valid value for a from output equivalence classes and Values of b and c are Triangle cannot be
SR 2 invalid values for b and c.
5 -1 -1 not in range formed
Enter the valid value for c from output equivalence classes Values of a and b are Triangle cannot be
SR 3 and invalid values for a and b.
-1 -1 10 not in range formed
Enter the valid value for a from output equivalence classes and Values of b and c are Triangle cannot be
SR 4 invalid values for b and c.
7 11 11 not in range formed
Enter the valid value for c from output equivalence classes Values of a and b are Triangle cannot be
SR 5 and invalid values for a and b.
11 11 10 not in range formed
Enter the valid value for b from output equivalence classes and Values of a and c are Triangle cannot be
SR 6 invalid values for a and c.
11 5 11 not in range formed
hj
Enter the valid values for b and c from output equivalence Values of a is not in Triangle cannot be
SR 7 classes and invalid value for a.
-1 5 5 range formed
Enter the valid values for a and c from output equivalence Values of b is not in Triangle cannot be
SR 8 classes and invalid value for b.
10 -1 10 range formed
Enter the valid values for a and b from output Values of c is not in Triangle cannot be
SR 9 equivalence classes and invalid value for c.
7 6 -1 range formed
Enter the valid values for b and c from output equivalence Values of a is not in Triangle cannot be
SR 10 classes and invalid value for a.
11 5 4 range formed
Enter the valid values for a and c from output equivalence Values of b is not in Triangle cannot be
SR 11 classes and invalid value for b.
2 11 3 range formed
Enter the valid values for a and b from output Values of c is not in Triangle cannot be
SR 12 equivalence classes and invalid value for c.
3 4 11 range formed
Values of a, b and c
Triangle cannot be
SR 13 Enter the invalid value for a, b and c. 11 11 11 are not in a
formed
range
Values of a, b and c
Triangle cannot be
SR 14 Enter the invalid value for a, b and c. -1 -1 -1 are not in a
formed
range
Program 5: Commission Problem
Testing Technique: Equivalence Class Testing

Design, develop, code and run the program in any suitable language to solve the commission problem. Analyse it
from the perspective of equivalence class testing, derive different test cases, execute these test cases and discuss
the test results.

Equivalence Class Test For The Commission Program

Equivalence Classes are as follows:


L1={ locks: 1<=locks<=70}
L2={ locks=-1}
S1={ stocks: 1<=stocks<=80}
B1={ barrels: 1<=barrels<=90}

Weak Normal /Strong Normal

Inputs Expected output


Test cases Description Comments
Locks Stocks Barrels Sales Com
Enter the valid value within range for
WN/SN1 locks, stocks and barrels
35 45 65 4550 770 valid

Enter the value of locks=-1 and valid inputs 2825 425


WN/SN2 for stocks and barrels
-1 40 65 valid
For Program termination
Weak Robust

Test Inputs Expected output


Description Comments
cases Locks Stocks Barrels Sales Com
Enter the value of lock less than -1 or equal to 2825 425
WR 1 zero and valid values for stocks -2 40 65 Value of locks not in the range of valid
and barrels 1..70
Enter the value of locks greater than 70 and 2825 425
WR 2 valid values for Stocks and barrels
72 40 65 Value of locks not in the range of valid
1..70
Enter the value of stocks less than or equal to zero 2700 400
WR 3 and valid values for locks and 35 -1 45 Value of stocks not in the range of valid
barrels 1..80
Enter the value of stocks greater than 80 and valid 2700 400
WR 4 values for locks and barrels
35 81 45 Value of stocks not in the range of 1..80 valid

Enter the value of barrels less than or equal to zero 2775 415
WR 5 and valid values for locks and 35 40 -1 Value of barrels not in the range of valid
stocks 1..90
Enter the value of barrels greater than 90 and valid 2775 415
WR 6 values for locks and stocks
35 40 91 Value of barrels not in the range of 1..90 valid

Strong Robust

Test Inputs Expected output


Description Comments
cases
Locks Stocks Barrels Sales Com
Enter the value of lock less than -1 or equal 2850 430 Valid
SR 1 to zero and valid values s for stocks and barrels. -2 45 60 Value of locks not in the range of 1..70

Enter the value of stocks less than or equal to zero 2700 400 Valid
SR 2 and valid values for locks and barrels.
35 -1 45 Value of stocks not in the range of
1..80
Enter the value of barrels less than or equal to zero 2775 415 Valid
SR 3 and valid values for locks and stocks.
35 40 -1
Value of barrels not in the range of 1..90
Enter the value of locks & stocks less than or equal to 1125 118.75 Valid
SR 4 zero and valid values for barrels.
-2 -1 45 Value of locks and stocks not in the range
1..70 & 1..80 resp
Enter the value of locks and barrels less than or equal 1200 130 Valid
SR 5 to zero and valid values for stocks.
-2 40 -1 Value of locks and barrels not in
range of 1..70 & 1..80 resp
1575 186.25
SR 6
Enter the value of stocks & barrels less than or equal Value of stocks and barrels not in Valid
35 -1 -1
to zero and valid values for locks. range of 1..80 & 1..90 resp

Value of locks,stocks & barrels


Enter the value of locks, stocks and barrels less than Valid
SR 7 or equal to zero.
-2 -1 -1 not in range of 1..70,1..80 & 1..90 resp

Enter the value of locks greater than 70 and valid 2325 325 Valid
SR 8 values for stocks and barrels.
71 40 45 Value of locks not in the range
of 1..70
Enter the value of stocks greater than 80 & valid 2700 400 Valid
SR 9 values for locks and barrels.
35 82 45 Value of stocks not in the range
of 1..80
Enter the value of barrels greater than 90 and valid 2775 415 Valid
SR 10 values for locks and stocks.
35 40 93 Value of barrels not in the range of
1..90
Enter the value of locks, stocks greater than 70,80 1125 118.75 Valid
SR 11 and valid values for barrels.
71 81 45 Value of locks & stocks not in the
range of 1..70 & 1..80 resp
Enter the value of stocks and barrels greater than 1575 186.25 Valid
SR 12 80,90 and valid values for locks.
35 81 91 Value of stocks & barrels not in the
range of 1..80 & 1..90 resp
Enter the value of locks and barrels greater than 70, 1200 130 Valid
SR 13 90 and valid values for stocks.
71 40 91 Value of locks & barrels not in range
of 1..70 & 1..90 resp
Value of locks,stocks and
Enter the value of locks, stocks &
SR 14 barrels greater than 70, 80, 90.
71 81 91 barrels not in the range of Valid
1..70,1..80 and 1..90 resp
Program 6: Next date program
Testing Technique: Equivalence Class Testing

Design, develop, code and run the program in any suitable language 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 cases Description Output Comments
DD MM YY
Enter valid values for day, month and year from
WN/SN1 12 2 1990 13/2/1990 Valid
equivalence classes.
Weak Robust

Test Inputs
Description Output Comments
cases DD MM YY
Enter valid values for month and year from equivalence classes and
WR1 invalid value for day.
-1 6 1992 Day out of range Valid

Enter valid values for day and year from equivalence classes
WR2 and invalid value for month.
15 -1 1992 Month out of range Valid

Enter valid values for day and month from equivalence classes and
WR3 invalid value for year.
15 6 1811 Year out of range Valid

Enter valid values for month and year from equivalence classes and
WR4 invalid value for day.
32 6 1992 Day out of range Valid

Enter valid values for day and year from equivalence classes
WR5 and invalid value for month.
15 13 1992 Month out of range Valid

Enter valid values for day and month from equivalence classes and
WR6 invalid value for year.
15 6 2016 Year out of range Valid

Strong Robust

Test Inputs
Description Output Comments
cases DD MM YY
Enter valid values for month and year from equivalence classes and
SR1 invalid value for day.
-1 6 1992 Day out of range Valid

Enter valid values for day and year from equivalence classes
SR2 and invalid value for month.
15 -1 1992 Month out of range Valid

Enter valid values for day and month from equivalence classes and
SR3 invalid value for year.
15 6 1811 Year out of range Valid
Enter valid value for year from equivalence classes and invalid Day, Month out of
Mṁ,,,, values for day and month.
-1 -1 1992 range
Valid
,,,,,,,,,,,
,,b
SR4
Enter valid value month for from equivalence classes and
SR5 invalid values for day and year.
-1 6 1811 Day, Year out of range Valid

Enter valid value for day from equivalence classes and invalid Month, Year out of
SR6 values for month and year.
15 -1 1811 range
Valid

SR7 Enter valid values for month and year from equivalence classes and
invalid value for day.
32 6 1992 Day out of range Valid

SR8 Enter valid values for day and year from equivalence classes
and invalid value for month.
15 13 1992 Month out of range Valid

SR9 Enter valid values for day and month from equivalence classes and
invalid value for year.
15 6 2016 Year out of range Valid

SR10 Enter valid value for year from equivalence classes and invalid Day, Month out of
values for day and month.
32 13 1992 range
Valid

SR11 Enter valid value month for from equivalence classes and
invalid values for day and year.
32 6 2016 Day, Year out of range Valid

SR12 Enter valid value for day from equivalence classes and invalid Month, Year out of
values for month and year.
15 13 2016 range
Valid

SR13 Day, Month, Year out of


Enter invalid values for day, month and year. -1 -1 1811 range
Valid

SR14 Day, Month, Year out of


Enter invalid values for day, month and year. 32 13 2016 range
Valid
Program 7: Triangle Problem
Testing Technique:Decision Table Approach
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 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;
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;
}

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
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
Conditions
C4: a=b -- -- -- T T F F F T T F
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 triangle x x x
Actions
A2: Equilateral x
A3: Isosceles x x x
A4: Scalene x

A5: Impossible x x x
Test Cases using Decision Table for Triangle Program
Inputs
Test Description
Output Comments
cases
A B C

Enter the values of a, b and c such that value of a is greater than sum of b
Case 1 7 2 3 Not a triangle Valid
and c.
Enter the values of a, b and c such that value of b is greater than sum of a
Case 2 2 8 3 Not a triangle Valid
and c.
Enter the values of a, b and c such that value of c is greater than sum of a
Case 3 2 4 7 Not a triangle Valid
and b.
Enter the values of a, b and c such that values of a,b and c are equal.
Case 4 5 5 5 Equilateral Valid
Enter the values of a, b and c Such that value of a is equal to value of b.
Case 5 4 4 3 Isosceles Valid

Enter the values of a, b and c such that value of b is equal to value of


Case 6 2 5 5 Isosceles Valid
c.
Enter the values of a, b and c such that value of a is equal to value of c.
Case 7 6 2 6 Isosceles Valid

Enter the values of a, b and c such that values of a,b and c are different.
Case 8 2 3 4 Scalene Valid

Enter the values of a, b and c such that value of a is equal to value of b


Case 9 ? ? ? Impossible Valid
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 equal to
Case 10 value of c and value of c is equal to a but value of a not equal to b. ? ? ? Impossible Valid

Enter the values of a, b and c such that value of a is equal


Case 11 to b and value of b is equal to value of c but value of a not equal to c. ? ? ? Impossible Valid
Program 8: Commission Problem
Testing Technique: Decision Table-based Testing
Design, develop, code and run the program in any suitable language to solve the commission problem. Analyse it
from the perspective of decision table-based 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

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

C2: 1<= stocks <=80 --- F T F T F T F T


Conditions
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 X X X X X X X X X
totalbarrels
a5: Calculate sales X X X X X X X X X
Test cases for Commission program for Input Decision table.
Test Inputs Expected output
Description Comments
cases Locks Stocks Barrels Sales Com
IDT1 Enter no. of locks=-1 -1 - - 0 0 valid
Program Terminates
Enter the valid no. of locks and invalid values 900 90
IDT2 for stocks and barrels
20 81 91 valid
Invalid no.of stocks and barrels
Enter the valid values for locks, stocks and invalid 1500 175
IDT3 value for barrels
20 20 96 valid
Invalid no.of barrels
Enter the valid values for locks and barrels and 1400 160
IDT4 invalid value for stocks
20 -1 20 valid
Invalid no.of stocks

Enter the valid values for locks, stocks and barrels 2000 260
IDT5 20 20 20 Calculates sales and valid
commission
Enter the invalid values for locks, stocks and barrels 0 0
IDT6 -2 81 -1 Invalid no.of locks, Stocks and valid
barrels.
Enter the valid value for stocks and invalid values 600 60
IDT7 for locks and barrels
-2 20 91 valid
Invalid no.of locks and barrels
Enter invalid input for locks and stocks and valid 500 50
IDT8 input for barrels
71 -1 20 valid
Invalid no.of locks and stocks
Enter the invalid value for locks and valid values 1100 115
IDT9 for stocks and barrels
-3 20 20 valid
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 Inputs Expected output
Description Comments
cases Locks Stocks Barrels Sales Com
Enter the value of locks,stocks and Barrels such that
IDT1 sales>1800.
19 18 18 1845 229 Valid
Enter the value of locks,stocks and
IDT2 Barrels such that sales>1000 and sales 14 14 14 1400 160 Valid
<=1800.
Enter the value of locks,stocks and Barrels
IDT3 such that sales<=1000.
5 5 5 500 50 Valid
Program 9: Commission Problem
Testing Technique: Dataflow Testing

Design, develop, code and run the program in any suitable language to solve the commission problem. Analyse it
from the perspective of dataflow testing, derive different test cases, execute these test cases and discuss the test
results.
1 #include<stdio.h>
2 #include<conio.h>
3 int main()
4 {
5 int c1,c2,c3,temp;
6 int locks,stocks,barrels,totallocks,totalstocks,totalbarrels;
7 float lockprice,stockprice,barrelprice,locksales,stocksales,barrelsales,sales,com;
8 lockprice=45.0;
9 stockprice=30.0; 10
barrelprice=25.0; 11
totallocks=0;
12 totalstocks=0;
13 totalbarrels=0;
14 clrscr();
15 printf("Enter the number of locks and to exit press -1\n");
16 scanf("%d",&locks);
17 while(locks != -1)
18 {
19 c1=(locks<=0 || locks>70);
20 printf("\nEnter the number of stocks and barrels\n");
21 scanf("%d %d",&stocks,&barrels);
22 c2=(stocks<=0 || stocks>80); 23
c3=(barrels<=0 || barrels>90); 24 if(c1)
25 printf("\nValue of locks are not in the range of 1......................70\n");
26 else
27 {
28 temp=totallocks+locks;
29 if(temp>70)
30 printf("New totallocks = %d not in the range of 1....................70\n",temp);
31 else
32 totallocks=temp;
33 }
34 printf("Total locks = %d",totallocks);
35 if(c2)
36 printf("\n Value of stocks not in the range of 1.....................80\n");
37 else
38 {
39 temp=totalstocks+stocks;
40 if(temp>80)
41 printf("\nNew total stocks = %d not in the range of 1.......................80",temp);
42 else
43 totalstocks=temp;
44 }
45 printf("\nTotal stocks = %d",totalstocks);
46 if(c3)
47 printf("\n Value of barrels not in the range of 1.....................90\n");
48 else
49 {
50 temp=totalbarrels+barrels;
51 if(temp>90)
52 printf("\nNew total barrels = %d not in the range of 1.......................90\n",temp);
53 else
54 totalbarrels=temp;
55 }
56 printf("\nTotal barrels=%d", totalbarrels);
57 printf("\nEnter the number of locks and to exit press -1\n");
58 scanf("%d",&locks);
59 }
60 printf("\n Total locks = %d",totallocks);
61 printf("\n Total stocks = %d",totalstocks); 62
printf("\n Total barrels = %d",totalbarrels); 63
locksales=totallocks*lockprice;
64 stocksales=totalstocks*stockprice;
65 barrelsales=totalbarrels*barrelprice;
66 sales=locksales+stocksales+barrelsales;
67 printf("\n Total sales = %f",sales);
68 if(sales>1800)
69 {
70 com=0.10*1000;
71 com=com+(0.15*800);
72 com=com+0.20*(sales-1800);
73 }
74 else if(sales>1000)
75 {
76 com=0.10*1000;
77 com=com+0.15*(sales-1000);
78 }
79 else
80 com=0.10*sales;
81 printf("\nCommission = %f",com);
82 getch();
83 return 0;
84 }
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

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

Check for stockprice variable 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,26,


2 DEF(stockprice,9) <9,64> 27,28,29,31,32,33,34,35,37,38,39,40,42,43,44,45, YES
And USE(stockprice,64) 46,48,49,50,51,53,54,55,56,57,58,59,60,61,62,63,64

Check for barrelprice variable 10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,


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

11,12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,29,31,32,33,34
<11,34> NO
Check for totallocks
variable 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,60> NO
4 DEF(totallocks,11,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 ,44,45,46,48,49,50,51,53,54,55,56,57,58,59,60,61,62,63 NO

32,33,34,35,37,38,39,40,42,43,44,45,46,48,49,50,51,53,54,55,56,57,58,17
<32,28> YES
,18,19,20,21,22,23,24,26,27,28
<32,34> 32,33,34
YES
<32,60> 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 YES

<32,63> 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,61,62,63
12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,29,31
<12,39> YES
,32,33,34,35,37,38,39

<12,45> NO
12,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

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

39,45,61,64)
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,63,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> 13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,29, NO
Check for totalbarrels 31,32,33,34,35,37,38,39,40,42,43,44,45,46,48,49,
variable
50,51,53,54,55,56,57,58,59,60,61,62
6 DEF(totalbarrels,13,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 variable
<16,28> 16,17,18,19,20,21,22,23,24,26,27,28 YES
7 DEF(locks,16,58)
<58,17> 58,17 YES
And USE(locks,17,19,28)
<58,19> 58,17,18,19 YES
<58,28> 58,17,18,19,20,21,22,23,24,26,27,28 YES
Check for stocks variable
<21,22> 21,22 YES
8 DEF(stocks,21)
<21,39> 21,22,23,24,26,27,28,29,31,32,33,34,35,37,38,39 YES
And USE(stocks,22,39)
Check for barrels variable 21,22,23
<21,23>
9 DEF(barrels,21) YES
21,22,23,24,25,26,27,28,29,31,32,33,34,35,37,38,39,40,42,43,44,45,
<21,50>
And USE(barrels,23,50) 46,47,48,49,50
Check for lockpsales variable
10 DEF(locksales,63) <63,66> 63,64,65,66 YES
And USE(locksales,66)
Check for stocksales variable
11 DEF(stocksales,64) <64,66> 64,65,66 YES
And USE(stocksales,66)
Check for barrelsales
variable
12 DEF(barrelsales,65) <65,66> 65,66 YES

And USE(barrelsales,66)
<66,67> 66,67 YES
Check for sales variable
DEF(sales,66) <66,68> 66,67,68 YES
13 And <66,72> 66,67,68,69,70,71,72 YES
USE(sales,67,68,72,74,77,8 0) <66,74> 66,67,68,74 YES
<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 NO
Check for commission <71,72> 71,72 NO
variable
<71,81> 71,72,73,81 NO
14 DEF(com,70,71,72,76,77,8 0)
<72,81> 72,73,81 YES
And USE(com,71,72,77,81) <76,77> 76,77 NO
<76,81> 76,77,78,81 NO
<77,81> 77,78,81 YES
<80,81> 80,81 YES

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.
Program 10: Binary Search
Testing Technique: Basis paths
Design, develop, 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>
A. 1 int binsrc(int x [ ],int low,int high,int key)
2 {
3 int mid;
B. 4 while(low<=high)
C. 5 {
6 mid=(low+high)/2;
D. 7 if(x[mid]==key)
I. 8 return mid;
E. 9 elseif(x[mid]<key)
G. 10 low=mid+1;
F. 11 else
12 high=mid-1;
H. 13 }
J. 14 return -1;
K. 15 }
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

14
7

8 9

11
15
10

12

13
DD Path graph

NODES DD-paths
1-3 A

4 B A

5,6 C
7 D
B
8 I
9 E
10 G C

11,12 F
13 H
14 J
15 K D
J

I E

K G F

H
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 new paths.
Considering Binary search program
Considering DD-Path graph of Binary search function, function starts at node A and Ends at node K. First, Base Line path is formed by
considering all decision nodes as shown below.

Baseline Path: AB CD 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 Expected Output Comment
N Array elements Key
Infeasible because low>high means
Enter the basis path consisting of all 2 {5,10} 4 from B to J then K which means no
TC1 Valid
decision nodes ABCDEFHBJK. 1 {10} 5 elements left which is
not true in any case.
Infeasible because low>high means
Enter the basis path consisting of all from B to J then K which means no
TC2 0 --------- ---- Invalid
decision nodes ABJK. elements left which is
not true in any case.
2 {5,10} 10 Element found in position 2
Enter the basis path consisting of all
TC3 3 {5,10,15} 10 Element found in position 2 Valid
decision nodes ABCDIK.
5 {5,10,15,20,25} 15 Element found in position 3
Infeasible because low>high means
Enter the basis path consisting of all 2 {5,10} 15 from B to J then K which means no
TC4 Invalid
decision nodes ABCDEGHBJK. 1 {10} 12 elements left which is
not true in any case.

Note
Path B J K indicates fail of while (low<=high) condition. Because when there is one element in the array, then low will b equal to high
(i.e., low=high). Similarly when there are more than one elements in the array low will be greater than high (i.e., low>high). So low>high
means there no elements in the array. So in above table paths containing B J K are considered as infeasible.
Program 11: Quick Sort
Testing Technique: Path Testing
Design, develop, code and run the program in any suitable language 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.

#include<stdio.h>
A. 1 void quicksort(int x[10],int first,int last)
B. 2 {
3 int temp,pivot,i,j;
C. 4 if(first<last)
D. 5 {
6 pivot=first;
7 i=first;
8 j=last;
E. 9 while(i<j)
F. 10 {
G. 11 while(x[i]<=x[pivot] && i<last)
H. 12 i++;
I. 13 while(x[j]>x[pivot])
J. 14 j--;
K. 15 if(i<j)
L. 16 {
17 temp=x[i];
18 x[i]=x[j];
19 x[j]=temp;
20 }
M. 21 }
N. 22 temp=x[pivot];
23 x[pivot]=x[j];
24 x[j]=temp;
25 quicksort(x,first,j-1);
P. 26 quicksort(x,j+1,last);
Q. 27 }
O. 28 }

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
1 2 4 5 6 7 8
3

28
9

26
10

22 11
27

12 13
23

14

24 15
21

16
25

17

18

19

20
DD path graph

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

Considering Quick Sort program


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

Baseline Path: ABC 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 decision nodes Infeasible because path from G to I means no
TC1
ABCDEFGIKMENABCOPABCO.
----
elements in array. Invalid

Enter the basis path consisting of all decision nodes


TC2 ABCO.
1 {9} Valid
Path C to D indicates if(first<last) is condition is
Enter the basis path consisting of all decision nodes true. So at first iteration
TC3 ABCDENABCO. ---- while(x[i]<=x[pivot]&&i<last) condition also should be Invalid
true and path E to F should be
present. But we have EN so Infeasible
Enter the basis path consisting of all decision nodes
TC4 ABCDEFGHGIKMENABCO.
2 {5,4 } Valid

Enter the basis path consisting of all decision nodes Infeasible because path from G to I means no
TC5
ABCDEFGIJIKMENABCO.
---- elements in array. Invalid

Enter the basis path consisting of all decision nodes Infeasible because path from G to I means no
TC6
ABCDEFGIKLMENABCO.
---- elements in array. Invalid

Enter the basis path consisting of all decision nodes Infeasible because path from G to I means no
TC7
ABCDEFGIKLMENABCOPABCO.
---- elements in array. Invalid

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) condition will 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.
Program 12: Absolute Letter Grading
Testing Technique: Path Testing

Design ,develop ,code and run the program in any suitable language 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.
#include<stdio.h>
#include<conio.h>
A. 1 int main()
2{
3 float per;
4 char grade;
5 printf("enter the percentage\n");
6 scanf("%f",&per);
B. 7 if(per>=90)
C. 8 grade='a';
D. 9 else if((per>=80) && (per<90))
E. 10 grade='b';
F. 11 else if((per>=70) && (per<80))
G. 12 grade='c';
H. 13 else if((per>=60) && (per<70))
I. 14 grade='d';
J. 15 else grade='e';
K. 16 switch(grade)
L. 17 {
M. 18 case 'a':printf("excellent\n");
19 break;
N. 20 case 'b':printf("very good\n");
21 break;
O. 22 case 'c':printf("good\n");
23 break;
P. 24 case 'd':printf("above average\n");
25 break;
Q. 26 case 'e':printf("satisfactory\n");
27 break;
R. 28 }
S. 29printf("the percentage is %f and the grade is %c\n",per,grade);
30 return 0;
31 }

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
18ISL66-SOFTWARE TESTING LABORATORY

Program graph 1 2 3 4 5 6

8 9

10 11

13
12

15
14

16

17

18 20 22 24 26

28

29

30

31

Dept. of ISE, MVJCE 2020-21 Page


61
18ISL66-SOFTWARE TESTING LABORATORY

DD path graph
A

Nodes DD-Paths
1-6 A B

7 B
8 C C D

9 D
E F
10 E
11 F
G
12 G H

13 H
I J
14 I
15 J
16 K
17 L K
18-19 M
20-21 N
L
22-23 O
24-25 P
M N O P Q
26-27 Q

28 R

29-31 S R

Dept. of ISE, MVJCE 2020-21 Page


62
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 all decision 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 Expected
Description Input Actual Output Comment
ID Output
Enter the basis path containing the decision Node J indicates grade „e‟ so case „e‟
TC1
nodes ABDFHJKLMRS 55 Satisfactory should be executed i.e., node Q. but there is Invalid
no Q in this path so Infeasible
Enter the basis path containing the decision
TC2
nodes ABCKLMRS 95 Excellent Excellent Valid

Enter the basis path containing the decision Node E indicates grade „b‟ so case „b‟ should
TC3
nodes ABDEKLMRS 85 Very good be executed i.e., node N. but Invalid
there is no N in this path so Infeasible
Enter the basis path containing the decision Node F indicates grade „c‟ so case „c‟
TC4
nodes ABDFGKLMRS 75 Good should be executed i.e., node O. but there is Invalid
no O in this path so Infeasible
Enter the basis path containing the decision Node H indicates grade „d‟ so case „d‟ should be
TC5
nodes ABDFHIKLMRS 65 Above average executed i.e., node P. but Invalid
there is no P in this path so Infeasible
Enter the basis path containing the decision Node J indicates grade „e‟ so case „e‟ should be
TC6
nodes ABDFHJKLNRS 55 Satisfactory executed i.e., node Q. but Invalid
there is no Q in this path so Infeasible
Enter the basis path containing the decision Node J indicates grade „e‟ so case „e‟ should
TC7 nodes ABDFHJKLORS 55 Satisfactory be executed i.e., node Q. but Invalid
there is no Q in this path so Infeasible
Enter the basis path containing the decision Node J indicates grade „e‟ so case „e‟
TC8
nodes ABDFHJKLPRS 55 Satisfactory should be executed i.e., node Q. but there is Invalid
no Q in this path so Infeasible
Enter the basis path containing the decision
TC9 nodes ABDFHJKLQRS 55 Satisfactory Satisfactory Valid
In above table we got test cases containing only Excellent and satisfactory type outputs. As we have five types of 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 decision nodes


TC10 ABDEKLNRS 85 Very good Very good Valid

Enter the basis path containing the decision nodes


TC11
ABDFGKLORS 75 Good Good Valid

Enter the basis path containing the decision nodes


TC12 ABDFHIKLPRS 65 Above average Above average Valid
15ISL67-Software Testing Lab manual

CONTENT BEYOND THE SYLLABUS

13. Aim:Take any system (e.g. ATM system) and study its system
specifications and report the various bugs.

Program:

Features to be tested:

1. Validity of the card.


2. Withdraw Transaction flow of ATM.
3. Authentication of the user’s.
4. Dispense the cash from the account.
5. Verify the balance enquiry
6. Change of PIN number
Bugs Identified:

Bug-Id Bug Name


ATM_001 Invalid Card

ATM_002 Invalid PIN

ATM_003 Invalid Account type

ATM_004 Insufficient Balance

ATM_005 Transaction Limit

ATM_006 Day limit

ATM_007 Invalid money denominations

ATM_008 Receipt not printed

ATM_009 PIN change mismatch

Bug Report:

Bug Id: ATM_001


Bug Description: Invalid card
Steps to reproduce: 1. Keep valid card in the ATM.
Expected Result: Welcome Screen
Actual Result: Invalid card
Status : Pass/Fail

Dept. of ISE, MVJCE 2020-21 Page 66


15ISL67-Software Testing Lab manual

Bug Id: ATM_002


Bug Description: Invalid PIN entered
Steps to reproduce:
1. Keep a valid card in ATM.
2. Enter the authorized PIN.
3. Menu screen should be displayed.
Expected Result: Menu screen displayed
Actual Result: Invalid PIN screen is displayed
Status : Pass/Fail

Bug Id: ATM_003


Bug Description: Invalid Account type selected.
Steps to reproduce:
1. Enter a valid user PIN number.
2. Select the withdraw option on the main menu.
3. Choose the correct type of account (either savings or current account).
Expected Result: Enter the Amount screen displayed
Actual Result: Invalid Account type screen is displayed.
Status : Pass/Fail

Bug Id: ATM_004


Bug Description: Insufficient Balance
Steps to reproduce:
1. Menu screen should be displayed.
2. Select the withdraw option.
3. Select the correct type of account.
4. Enter the sufficient amount to withdraw from the account.
5. Dispense the cash screen & amount to be deducted from account
Expected Result: Collect the amount screen displayed
Actual Result: Insufficient balance in the account
Status : Pass/Fail

Bug Id: ATM_005


Bug Description: Withdraw Limit per transaction.
Steps to reproduce:
1. Menu screen should be displayed.
2. Select the withdraw option.
3. Select the correct type of account.
4. Enter sufficient amount to withdraw from the account Transaction within the limit.
5. Dispense the cash screen & amount to be deducted from account.
Expected Result: Cash is dispensed and collect the receipt
Actual Result: Transaction limit exceeded screen is displayed
Status : Pass/Fail

Dept. of ISE, MVJCE 2020-21 Page 67


15ISL67-Software Testing Lab manual

Bug Id: ATM_006


Bug Description: Withdraw limit per day
Steps to reproduce:
1. Keep a valid card in ATM.
2. Enter the authorized PIN.
3. Enter the amount to withdraw from the account.
4. Amount enter is over the day limit (>40000)
5. Amount enter is over the day limit and display screen is displayed.
Expected Result: Cash is dispensed and collect the receipt.
Actual Result: Day limit exceeded screen is displayed.
Status : Pass/Fail

Bug Id: ATM_007


Bug Description: Amount enter denominations
Steps to reproduce:
1. Keep a valid card in ATM.
2. Enter the authorized PIN.
3. Enter the amount which should be in multiples of 100.
4. Cash Dispenser screen is displayed.
Expected Result: Collect the amount screen is displayed.
Actual Result: Amount enter not in required denominations.
Status : Pass/Fail

Bug Id: ATM_008


Bug Description: Statement not printed
Steps to reproduce:
1. Keep a valid card in ATM.
2. Enter the authorized PIN.
3. Select the mini statement.
4. Current balance is displayed on the screen.
5. Collect printed receipt of the statement. Expected
Result: Collect the mini statement receipt Actual
Result: receipt not printed.
Status : Pass/Fail

Bug Id: ATM_009


Bug Description: PIN mismatch
Steps to reproduce:
1. Keep a valid card in ATM.
2. Enter the authorized PIN.
3. Select the change PIN option on the menu.
4. Enter the current PIN.
5. Enter the new PIN.
6. Retype the new PIN

Dept. of ISE, MVJCE 2020-21 Page 68


15ISL67-Software Testing Lab manual

7. PIN successfully changed displayed on the screen.


Expected Result: PIN change successful.
Actual Result: PIN mismatched due to wrong PIN entered
Status : Pass/Fail

S 1 Validate the Enter invalid System should Custome Pass Ex:


B login page user name and not allow the r is not
I enter invalid/ valid password customer to able to UID:a
wrong user in SBI online login the SBI login SBI bcdef
name and Banking login online Banking online
PWD:x
valid page login page and banking
yz123
password it should account
display the
message like
O ”please enter
N valid user
L name and
I password”
N 2 validate the Enter invalid System should Custome Pass Ex:
E login page user name and not allow the r is not
enter invalid invalid pass customer to able to UID:a
user name and word in SBI login the SBI login SBI bcd
invalid online Banking online Banking online
PWD:x
password login page login page and Banking
B yz12
it should account
A
display the
N
message like “
K
please enter
I
valid user
N
name and
G
password
3 Validate the Enter valid System should Customer Pass Ex:
login page user name and allow the user is logged
enter valid invalid to login the in to SBI UID:a
user name password in SBI online online bcdefg
A and invalid SBI online Banking login Banking
PWD:x
P password Banking login page login
yz123 4
P page page

Dept. of ISE, MVJCE 2020-21 Page 69


15ISL67-Software Testing Lab manual

L 4 Validate the Enter valid System should Customer Pass Ex:


I login page user name and allow the user is logged
C enter valid valid password to login the into SBI UID:a
A user name in SBI online SBI online online bcdefg
T and valid Banking login Banking login Banking
PWD:x
I password page page login
yz
O page
N 123
5 Validate the a a Custome fail
user ) ) r is not
information U able to
s U
or detail in see
e s
the r e phone or
profile page r mobile
s / number
h c
o u
u s
l t
d o
m
a e
b r
l
e s
h
t o
o u
l
l d
o
g a
i b
n l
e
S
B t
I o
login SBI
l login page
o with valid
g
i b
n )
C
p u
a s
g t
e o

Dept. of ISE, MVJCE 2020-21 Page 70


15ISL67-Software Testing Lab manual

b m
) e
U r
s
e s
r h
o
s u
h l
o d
u
l b
d e
able to click
on profile link a
c b
) l
O e
n
t
c o
l
i c
c l
k i
i c
n k
g
p
p r
r o
o f
f i
i l
l e
e
l
l i
i n
n k
k .

u c
s )
e C
s u
s
s t
h o
o m
u e
r

Dept. of ISE, MVJCE 2020-21 Page 71


15ISL67-Software Testing Lab manual

l
d s
h
a o
b u
l l
e d

t s
o e
e
s
e a
e l
l
a
l t
l h
e
u
s c
e u
r s
t
d o
e m
t e
a r
i
l i
s n
f
l o
i r
k m
e a
1)User t
/customer i
name o
2 n
) once he
U clicking on
s profile
e hyper link
r
/
c
u
s
t
o
m
Dept. of ISE, MVJCE 2020-21 Page 72
15ISL67-Software Testing Lab manual

e
r

a
d
d
r
e
s
s

d
e
t
a
i
l
s
3
)
U
s
e
r
/
c
u
s
t
o
m
e
r

p
h
o
n
e

n
u
m
b
e
r

14. Study of any web testing tool (e.g. Selenium)

Selenium is a robust set of tools that supports rapid development of test automation for
web-based applications. Selenium provides a rich set of testing functions specifically

Dept. of ISE, MVJCE 2020-21 Page 73


15ISL67-Software Testing Lab manual

geared to the needs of testing of a web application. These operations are highly flexible,
allowing many options for locating UI elements and comparing expected test results
against actual application behavior.
One of Selenium‘s key features is the support for executing one‘s tests on multiple
browser platforms.
Selenium Components
Selenium is composed of three major tools. Each one has a specific role in aiding
the development of web application test automation.
Selenium-RC provides an API (Application Programming Interface) and library for each
of its supported languages: HTML, Java, C#, Perl, PHP, Python, and Ruby. This ability
to use Selenium-RC with a high-level programming language to develop test cases also
allows the automated testing to be integrated with a project‘s automated build
environment.
Selenium-Grid
Selenium-Grid allows the Selenium-RC solution to scale for large test suites or test suites
that must be run in multiple environments. With Selenium-Grid, multiple instances of
Selenium-RC are running on various operating system and browser configurations; Each

of these when launching register with a hub. When tests are sent to the hub they are then redirected
to an available Selenium-RC, which will launch the browser and run the test. This allows for
running tests in parallel, with the entire test suite theoretically taking only as long to run as the
longest individual test.
* Tests developed on Firefox via Selenium-IDE can be executed on any other supported browser
via a simple Selenium-RC command line.
** Selenium-RC server can start any executable, but depending on browser security settings there
may be technical limitations that would limit certain features.
Flexibility and Extensibility
Selenium is highly flexible. There are multiple ways in which one can add functionality to
Selenium‘s framework to customize test automation for one‘s specific testing needs. This is,
perhaps, Selenium‘s strongest characteristic when compared with proprietary test automation tools
and other open source solutions. Selenium-RC support for multiple programming and scripting
languages allows the test writer to build any logic they need into their automated testing and to use
a preferred programming or scripting language of one‘s choice.
Selenium-IDE allows for the addition of user-defined ―user-extensions‖ for creating additional
commands customized to the user‘s needs. Also, it is possible to re-configure how the Selenium-
IDE generates its Selenium-RC code. This allows users to customize the generated code to fit in
with their own test frameworks. Finally, Selenium is an Open Source project where code can be
modified and enhancements can be submitted for contribution.
.Test Suites
A test suite is a collection of tests. Often one will run all the tests in a test suite as one
continuous batch-job.
When using Selenium-IDE, test suites also can be defined using a simple HTML file.
The syntax again is simple. An HTML table defines a list of tests where each row

Dept. of ISE, MVJCE 2020-21 Page 74


15ISL67-Software Testing Lab manual

defines the filesystem path to each test. An example tells it all.

<html>
<head>
<title>Test Suite Function Tests – Priority 1</title>
</head> <body>
<table>
<tr><td><b>Suite Of Tests</b></td></tr>
<tr><td><a href=‖./Login.html‖>Login</a></td></tr>
<tr><td><a href=‖./SearchValues.html‖>Test Searching for
Values</a></td></tr> <tr><td><a href=‖./SaveValues.html‖>Test
Save</a></td></tr>
</table>
</body> </html>
A file similar to this would allow running the tests all at once, one after another, from the
Selenium-IDE.

Test suites can also be maintained when using Selenium-RC. This is done via programming and
can be done a number of ways. Commonly Junit is used to maintain a test suite if one is using
Selenium-RC with Java. Additionally, if C# is the chosen language, Nunit could be employed. If
using an interpreted language like Python with Selenium-RC than some simple programming
would be involved in setting up a test suite. Since the whole reason for using Sel-RC is to make
use of programming logic foryour testing this usually isn‘t a problem. Few typical Selenium
commands.

Dept. of ISE, MVJCE 2020-21 Page 75


15ISL67-Software Testing Lab manual

open – opens a page using a URL.


click/clickAndWait – performs a click operation, and optionally waits for a new page to
load.
verifyTitle/assertTitle – verifies an expected page title.
verifyTextPresent – verifies expected text is somewhere on the page.
verifyElementPresent – verifies an expected UI element, as defined by its HTML tag, is
present on the page.
verifyText – verifies expected text and it‘s corresponding HTML tag are present on the
page.
verifyTable – verifies a table‘s expected contents.
waitForPageToLoad – pauses execution until an expected new page loads. Called
automatically when clickAndWait is used.
waitForElementPresent – pauses execution until an expected UI element, as defined by
its HTML tag, is present on the page.

Dept. of ISE, MVJCE 2020-21 Page 73


15ISL67-Software Testing Lab manual

VIVA-QUESTIONS

1. What is the MAIN benefit of designing tests early in the life cycle? 
It helps prevent defects from being introduced into the code.

2. What is risk-based testing?

Risk-based testing is the term used for an approach to creating a test strategy that is based on
prioritizing tests by risk. The basis of the approach is a detailed risk analysis and prioritizing
of risks by risk level. Tests to address each risk are then specified, starting with the highest
risk first.

3. What is the KEY difference between preventative and reactive approaches to testing?

Preventative tests are designed early; reactive tests are designed after the software has been
produced.

4. What is the purpose of exit criteria?

The purpose of exit criteria is to define when a test level is completed.

5. What determines the level of risk?

 The likelihood of an adverse event and the impact of the event determine the level of risk.

6. When is used Decision table testing?

Decision table testing is used for testing systems for which the specification takes the form of
rules or cause-effect combinations. In a decision table the inputs are listed in a column, with
the outputs in the same column but below the inputs. The remainder of the table explores
combinations of inputs to define the outputs produced.

7. What is the MAIN objective when reviewing a software deliverable?

To identify defects in any software work product.

8. Which of the following defines the expected results of a test? Test case specification or
test design specification.

Test case specification defines the expected results of a test.

9. What is the benefit of test independence?

It avoids author bias in defining effective tests.

10. As part of which test process do you determine the exit criteria?

The exit criteria is determined on the bases of 'Test Planning'.

11. What is beta testing?

Testing performed by potential customers at their own locations.

12. What is the difference between Testing Techniques and Testing Tools?

Dept. of ISE, MVJCE 2020-21 Page 74


15ISL67-Software Testing Lab manual

Testing technique: – Is a process for ensuring that some aspects of the application system or
unit functions properly there may be few techniques but many tools.

Testing Tools: – Is a vehicle for performing a test process. The tool is a resource to the tester,
but itself is insufficient to conduct testing

13. What is component testing?

Component testing, also known as unit, module and program testing, searches for defects in,
and verifies the functioning of software (e.g. modules, programs, objects, classes, etc.) that
are separately testable. Component testing may be done in isolation from the rest of the
system depending on the context of the development life cycle and the system. Most often
stubs and drivers are used to replace the missing software and simulate the interface between
the software components in a simple manner. A stub is called from the software component
to be tested; a driver calls a component to be tested.

14. What is functional system testing?

Testing the end to end functionality of the system as a whole is defined as a functional system
testing.

15. What are the benefits of Independent Testing?

Independent testers are unbiased and identify different defects at the same time.

16. In a REACTIVE approach to testing when would you expect the bulk of the test
design work to be begun?

The bulk of the test design work begun after the software or system has been produced.

17. What are the different Methodologies in Agile Development Model?

There are currently seven different agile methodologies that I am aware of:

1. Extreme Programming (XP)


2. Scrum
3. Lean Software Development
4. Feature-Driven Development
5. Agile Unified Process
6. Crystal
7. Dynamic Systems Development Model (DSDM) 

18. Which activity in the fundamental test process includes evaluation of the testability
of the requirements and system?

A 'Test Analysis' and 'Design' includes evaluation of the testability of the requirements and
system.

19. What is typically the MOST important reason to use risk to drive testing efforts?

Because testing everything is not feasible.


Dept. of ISE, MVJCE 2020-21 Page 75
15ISL67-Software Testing Lab manual

20. What is random/monkey testing? When it is used?

Random testing often known as monkey testing. In such type of testing data is generated
randomly often using a tool or automated mechanism. With this randomly generated input the
system is tested and results are analysed accordingly. These testing are less reliable; hence it
is normally used by the beginners and to see whether the system will hold up under adverse
effects.

21. Which of the following are valid objectives for incident reports?

1. Provide developers and other parties with feedback about the problem to enable
identification, isolation and correction as necessary.
2. Provide ideas for test process improvement.
3. Provide a vehicle for assessing tester competence.
4. Provide testers with a means of tracking the quality of the system under test.  

22. Consider the following techniques. Which are static and which are dynamic
techniques?

1. Equivalence Partitioning.
2. Use Case Testing.
3. Data Flow Analysis.
4. Exploratory Testing.
5. Decision Testing.
6. Inspections.

Data Flow Analysis and Inspections are static; Equivalence Partitioning, Use Case Testing,
Exploratory Testing and Decision Testing are dynamic.

23. Why are static testing and dynamic testing described as complementary?

Because they share the aim of identifying defects but differ in the types of defect they find.

24. What are the Structure-based (white-box) testing techniques?

Structure-based testing techniques (which are also dynamic rather than static) use the internal
structure of the software to derive test cases. They are commonly called 'white-box' or 'glass-
box' techniques (implying you can see into the system) since they require knowledge of how
the software is implemented, that is, how it works. For example, a structural technique may
be concerned with exercising loops in the software. Different test cases may be derived to
exercise the loop once, twice, and many times. This may be done regardless of the
functionality of the software.

25. When "Regression Testing" should be performed?

After the software has changed or when the environment has changed Regression testing
should be performed.

Dept. of ISE, MVJCE 2020-21 Page 76


15ISL67-Software Testing Lab manual

26. What is negative and positive testing?

A negative test is when you put in an invalid input and receives errors. While a positive
testing, is when you put in a valid input and expect some action to be completed in
accordance with the specification. 

27. What is the purpose of a test completion criterion?

The purpose of test completion criterion is to determine when to stop testing

28. What can static analysis NOT find?

For example memory leaks.

29. What is the difference between re-testing and regression testing?

Re-testing ensures the original fault has been removed; regression testing looks for
unexpected side effects.

30. What are the Experience-based testing techniques?

In experience-based techniques, people's knowledge, skills and background are a prime


contributor to the test conditions and test cases. The experience of both technical and
business people is important, as they bring different perspectives to the test analysis and
design process. Due to previous experience with similar systems, they may have insights into
what could go wrong, which is very useful for testing.

31. When should testing be stopped?

It depends on the risks for the system being tested. There are some criteria bases on which
you can stop testing.

1. Deadlines (Testing, Release)


2. Test budget has been depleted
3. Bug rate fall below certain level
4. Test cases completed with certain percentage passed
5. Alpha or beta periods for testing ends
6. Coverage of code, functionality or requirements are met to a specified point

32.  What is black box testing? What are the different black box testing techniques?

Black box testing is the software testing method which is used to test the software without
knowing the internal structure of code or program. This testing is usually done to check the
functionality of an application. The different black box testing techniques are

1. Equivalence Partitioning
2. Boundary value analysis
3. Cause effect graphing

Dept. of ISE, MVJCE 2020-21 Page 77


15ISL67-Software Testing Lab manual

33. Why does the boundary value analysis provide good test cases?
Because errors are frequently made during programming of the different cases near the
'edges' of the range of values.

34. What makes an inspection different from other review types?


It is led by a trained leader, uses formal entry and exit criteria and checklists.

35. What is a V-Model?


A software development model that illustrates how testing activities integrate with software
development phases

Dept. of ISE, MVJCE 2020-21 Page 78


15ISL67-Software Testing Lab manual

MVJ COLLEGE OF ENGINEERING


DEPARTMENT OF INFORMATION SCIENCE AND ENGINEERING
DO'S AND DON'TS
Do's
1.   Do wear ID card and follow dress code.
2. Do log off the computers when you finish.
3.    Do ask the staff for assistance if you need help. 
4.    Do keep your voice low when speaking to others in the LAB.
5.    Do ask for assistance in downloading any software.
6.    Do make suggestions as to how we can improve the LAB.
7. In case of any hardware related problem, ask LAB in charge for solution.
8. if you are the last one leaving the LAB, make sure that the staff in charge of the LAB is
informed to close the LAB.
9. Be on time to LAB sessions.
10. Do Keep the LAB as clean as possible
Don'ts
1. Do not use mobile phone inside the lab.
2. Don't do anything that can make the LAB dirty (like, eating, throwing waste papers etc).
3. Do not carry any external devices without permission.
4. Don't move the chairs of the LAB.
5. Don't interchange any part of one computer with another.
6. Don't leave the computers of the LAB turned on while leaving the LAB.
7. Do not install or download any software or modify or delete any system files on any lab
computers.
8. Do not damage, remove, or disconnect any labels, parts, cables, or equipment.
9. Don't attempt to bypass the computer security system.
10. Do not read or modify other users' files.
11. If you leave the lab, do not leave your personal belongings unattended. We are not
responsible for any theft.

Dept. of ISE, MVJCE 2020-21 Page 79

You might also like