SOFTWARE TESTING Lab Manual
SOFTWARE TESTING Lab Manual
III – B.Sc CS
VI SEMESTER
LAB MANUAL
PROGRAMME OUTCOME
PO-1 Students become knowledgeable academically to implement the principles and for rapid
growth of the IT industry.
PO-2 The programme offers face to face teaching with project-based learning, ensuring the
graduate with technical fluency.
PO - 1 This programme helps to develop academically competent and professionally motivated
personnel equipped with critical thinking that helps to improve the scientific temper with a sense
of social responsibility.
PO-2 This programme imbibes development of Software quality practices circumstances with an
understanding of the limitations.
PO - 2 To demonstrate the knowledge gained by understanding scientific and mathematical
skills to apply these in their own work.
F-LBM- 23-22K Software Testing Lab
PO - 3 They will be able to comprehend, write effective reports, design documentation and make
effective presentations. Students will be able to change their perspectives to the new
developments in the field of Computer Science.
PSO - 1 One of the most recognized UG degree B.Sc. Computer Science for
employment byapplying in government exams and also in private sectors.
PSO - 2 The programme implements the knowledge attained in their own domain area of
programming to exhibit their skills and competencies in the following knowledge areas: i) Data
Structures and programming languages.
COURSE OBJECTIVE
1) The objective of the problem is to find the sum of individual digits of a given ten digit
number by finding the remainder and dividing the number for the next term. Finally adding
all the digits until it reduces to a single digit.
2) The objective of the problem is to check whether the student’s result is PASS or FAIL from
the given marks list of various subjects. Declare the results as pass if the student gets
minimum 40 in each subject.
3) The objective of the problem is to generate the prime number series for the given number.
4) The objective of the problem is to merge the two ordered lists, so that the resultant is the
ordered one and this process is called merging. Two elements are taken and after
comparison, whichever is smaller that is added into the ordered list.
5) The objective of the problem includes in demonstrating the various operations of stack using
the array implementation. Stack is an ordered list in which all insertions and deletions takes
place at one end called top of stack.
6) The objective of the problem is to create an menu driven program to implement the queue
operations like insertions, deletions, modifications and listing of elements.
7) The objective of the program is to test the C++ program to check whether the given string
is palindrome or not using pointers.
COURSE OUTCOME:
F-LBM- 23-22K Software Testing Lab
LIST OF PROGRAMS
1. Test the C program: Finding the sum of individual digits of a 10-digit number until a
single digit is produced.
2. Test the C Program: Accept the inputs student name, marks in five subjects and
declare the result as PASS if the student gets minimum 40 in each subject; otherwise
declare the result as FAIL.
3. Test the C program: for generating n prime numbers.
4. Test the C program: Sort and store the elements of two arrays of integers into the third
list.
5. Test the C program: Experiment the operations of a stack using array implementation.
6. Test the C program: Menu-driven option for queue operations like add, remove and
display.
7. Test the C++ program: Palindrome string checking program (using pointers).
ENHANCEMENT:
1. Develop test cases for the project using white box testing.
2. Develop Software requirement Specification (SRS) document in IEEE format for the
project.
PRE-REQUISITE:
Ex.No.01
AIM:
To test a C program for finding the sum of individual digit of a 10 digit number until a
single digit is produced.
ALGORITHM:
environment.
Step 4: Get 10 digits from the user which is stored in the variable called temp for
temporary storage.
SOURCE CODE:
#include<stdio.h>
int main(void)
{
long num;
int dig,sum;
printf("Enter any number : ");
scanf("%ld",&num);
printf("%ld-> ",num);do
{
sum = 0;
while(num!=0)
{
dig=num%10;
sum+=dig;
num/=10;
}
printf("%d-> ",sum);
num=sum;
}while(num/10!=0);
Return 0; }
TEST CASES:
F-LBM- 23-22K Software Testing Lab
TC-01 Input case Enter the number Accept integer Accepted SUCCESS
Positive. in respect of any in respect of integer in
number of digits any respect of any
as integer. number of digits. number of
digits.
TC-02 Input case Enter the number Kindly input Accepted only FAILURE
Negative. in respect of any the valid data. the integer part
number of digits and neglect the
as real. decimal values.
TC-03 Process case Add the digit one Accept the Accepted the SUCCESS
Check whether by one until it correct value of correct value
it producing a produces a single the single digit. of the single
single digit- digit. digit.
positive.
TC-04 Process case Add the digit one Don’t accept Don’t accept SUCCESS
Check whether by one until it the value if it the value if it
it producing a produces a single produces a produces a
single digit- digit. final output final output
Negative. more than one more than one
digit. digit.
TC-08 Digit sum of 10 Output data. Single digit sum. Single digit sum. SUCCESS
digit is in single
number.
F-LBM- 23-22K Software Testing Lab
TC-10 Check if Count If it is false then Should not Go Should not Go SUCCESS
is less than 10 will not process to ADD- to ADD-
(count<10). goto DIGIT. DIGIT.
ADD DIGIT .
OUTPUT :-
Ex.No.02
STUDENT MARKSHEET RESULT
AIM:
F-LBM- 23-22K Software Testing Lab
To test a C program to accept the inputs student name, marks in five subjects and declare the
result as pass if the student gets minimum 40 in each subject, otherwise declare the result as
FAIL.
ALGORITHM:
Step 3: Declare the main function under it declare the required variables such as
rollno,name,m1,m2,m3,m4,m5.
Step 4: Get the name and roll number and five subject marks from the user using get
statement. Step 5: The marks are checked using if statement and finally the result is displayed
“pass” or “Fail”.
SOURCE CODE:
#include<stdio.h>
#include<conio.h>
void main()
{
int rollno, m1,m2,m3,m4,m5;
char name[30];
printf(“enter roll no:”);
scanf(“%d”, &rollno);
printf(“enter name:”);
scanf(“%s”, &name);
printf((“enter marks for 5 subjects:”);
scanf(“%d%d%d%d%d”,&m1,&m2,&m3,&m4,&m5)
; if ( (m1<40)||(m2<40)||(m3<40)||(m4<40)||(m5<40))
{
printf(“RESULT IS FAIL”);
}
else
{
F-LBM- 23-22K Software Testing Lab
printf(“RESULT IS PASS”);
}
getch();
}
TEST CASES:
TEST TEST TEST STEPS EXPECTED ACTUAL STATUS
ID DESCRIPTION OUTPUT OUTPUT
TC-01 Input case 1. Enter the student Accept name Accepted name SUCCESS
Positive. name as characters in character in character
2. Enter marks for 5 and and
subjects as (min- marks in real. marks in real.
0,max 100) as real
number.
TC-02 Input case 1.Enter the student “Kindly Input “Kindly Input SUCCESS
Negative. name as characters the valid data”. the valid data”.
2.Enter marks for 5
subjects as (min-
0,max 100) as
integer num.
TC-03 Process case Check the entered Produce the Produce the SUCCESS
check for pass marks with the result as PASS. result as PASS.
positive. constraint
(all marks>=40).
TC-04 Process case Check the entered Produce the Produce the SUCCESS
check for fail marks with the result as FAIL. result as FAIL.
negative. constraint
(all 5 marks <40).
TC-05 Output case 1. Title of the 1. Produce the 1. Produce the SUCCESS
check for the program. 2. Input result of the result of the
formatted output. query. student. student.
3. Output query. 2. Enter the 2. Enter the
4. Line space. name of the name of the
student. student.
3. Result of 3. Result of
the student the student
P/F. P/F.
TC-06 Check all the If it is true then the The result is The result is SUCCESS
subjects result will be PASS. PASS. PASS
marks are
greater than
39
(marks>39).
F-LBM- 23-22K Software Testing Lab
TC-07 Check all the If it is false then The result is The result is SUCCESS
subjects the result will be FAIL. FAIL.
marks are FAIL.
greater than
39
(marks>39).
TC-08 INPUT- In Input-Enter All the Data All the Data SUCCESS
display case. marks for 5 are accepted. are accepted.
subjects
TC-09 OUTPUT In Output-Print the All the Data All the Data SUCCESS
display case. result. are are
Displayed. Displayed.
TC-10 Condition. Check the student has The student is The student is SUCCESS
got PASS in all pass. pass.
Subjects.
OUTPUT :-
STUDENT MARKLIST
75
60
95
88
78
Ex.No.03
AIM:
F-LBM- 23-22K Software Testing Lab
ALGORITHM:
Step 3: Take the integer variable i, divide the variable i with (i-1 to 2) Step 4: If variable i is
divisible by any value (i-1 to 2 ) it is not prime, otherwise it is prime. Step 5: Get the flag
SOURCE CODE:
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,j,y;
clrscr();
printf("\n\t\t\t Generating prime
numbers"); printf("\n\n\tEnter the value for
n:");
scanf("%d",&n);
printf("\n\n\t**Prime numbers between 1 to \%d**\n",n);
printf("\n\t1 is neither or not prime number\n");
for(i=2;i<=n;i++)
{
y=0;
for(j=2;j<i;j++)
{
if(i%j==0)
F-LBM- 23-22K Software Testing Lab
{
y=1;
break;
}
}
if(y==0)
{
printf("\n\tprime number:%d",i);
}
}
getch();
}
TEST CASES:
TC-02 Input case Enter the n “Kindly Input “Kindly Input SUCCESS
Negative. number as a valid a valid
character for Data”. Data”.
generating prime
numbers.
TC-03 Process case Type the number Accept the Accepted the SUCCESS
Check whether in integer until it values in values in
it producing a generates the integers. integers.
list of prime sequence
numbers–
Positive.
TC-04 Process case Type the number Don’t accept Not SUCCESS
Check whether it in integer until it the value if it accepting
is prompting to produces a prime produce a final the values.
enter a number number format. output as
starts from 1- another
Negative. format.
F-LBM- 23-22K Software Testing Lab
TC-06 INPUT-CASE Enter the value for n. Accept the value. Accepted the SUCCESS
value.
OUTPUT :-
Enter the value of n
7
2357
Ex.No: 4
AIM:
To test a C program to sort and store the elements of two arrays of type integers into the
third list.
F-LBM- 23-22K Software Testing Lab
ALGORITHM:
Step 3: Initialize the size for the input array variables to zero using a loop. Step 4: Enter the size
of an array and the elements in array 1 and array2 during runtime. Step 5: Compare the elements
of array1 and array 2 using decision making statement and sort the elements.
Step 6: The sorted list of array1 and array2 are merged and stored as values in
SOURCE CODE
#include<stdio.h>
#define MAX 20
int i,j,temp;
temp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = temp;
F-LBM- 23-22K Software Testing Lab
}/*End of if*/
F-LBM- 23-22K Software Testing Lab
arr3[k++]=arr1[i++];
else
arr3[k++]=arr2[j++];
}/*End of while*/
/*Merging completed*/
main()
int arr1[MAX],arr2[MAX],arr3[40];int
i,j,k;
int size1,size2;
bubble_sort(arr1,size1);
bubble_sort(arr2,size2);
merge(arr1,size1,arr2,size2,arr3);
printf("\nMerged list : ");
for(i=0;i<size1+size2;i++)
printf("%d ",arr3[i]);
printf("\n"); }/*End of main()*/
TEST CASES:
OUTPUT :-
Enter the size of array1:2
Enter the elements of first
array 2
3
Enter the limit of array2:2 Enter
the elements of second array 6
F-LBM- 23-22K Software Testing Lab
7
Enter sorted elements of array
1: 2 3
Enter sorted elements of array
2: 6 7
The merged list:
2367
Ex.No: 5
STACK OPERATIONS
AIM:
F-LBM- 23-22K Software Testing Lab
implementation.
ALGORITHM:
Step 2: Declare the variables as stack, top, i and choice for stack operation.
Step 3: Get the input for the size of the stack and the elements in the stack. Step 4: Check using the if
condition to validate when the maximum size of stack occurs in overflow.
Step 5: Use top=top+1 to increment the top 1, to push the elements at the top of stack, and then
Step 6: Display the elements of stack and use exit() to exit from the
SOURCE CODE:
#include <stdio.h>
#include <stdlib.h>
#define MAX 10
int STACK[MAX],TOP;
void main()
int ITEM=0;
int choice=0;
F-LBM- 23-22K Software Testing Lab
TOP=-1;
while(1)
/*clrscr();*/
scanf("%d",&choice);
switch(choice)
case 1:
display(STACK);
break;
case 2:
break;
case 4:
exit(0);
default:
printf("\nInvalid choice.");
break;
}
F-LBM- 23-22K Software Testing Lab
getch();
*/
int i=0;
if(TOP==-1)
{
printf("\n%d",stack[i]);
printf("\n\n");
}
/* function : PUSH(),
*/
if(TOP==MAX-1)
}
TOP++;
stack[TOP]=item;
}
/* function : POP(),
*/
int deletedItem;
if(TOP==-1)
{
printf("STACK is EMPTY.\n");
return;
}
deletedItem=stack[TOP];
TOP--;
printf("%d deleted successfully\n",deletedItem);
F-LBM- 23-22K Software Testing Lab
return;
TEST CASES:
TEST TEST TEST STEPS EXPECTED ACTUAL STATUS
ID DESCRIPTION OUTPUT OUTPUT
OUTPUT :-
Enter your
choice:1
Stack Overflow
Ex.No: 6
QUEUE OPERATIONS
AIM:
1. Insertion
2. Deletion
3. Modification
4. List
ALGORITHM:
Step 1: Declare one-dimensional array and an integer pointer variable and variables for insertion,
loops, option and size.
Step 3: The queue operation is performed using menu driven program and the menu includes a
number of choice.
Step 4: If the choice is 1, and it checks the condition whether the rear is equal to size and if it is
false then, else part is executed, i.e., it increments the rear and the new element is added.
Step 5: If the choice is 2, and it checks the condition whether the rear is equal to zero and if it is
false then, else part is executed, i.e., it will delete an element from the front of queue and the
remaining elements are moved one position front and rear is decremented.
Step 6: If the choice is 3, and it checks the condition whether the rear is equal to zero and if it is
false then, else part is executed, i.e., it lists the elements present in the queue.
Step 7: If the choice is 4, and it checks the condition whether the rear is equal to zero and if it is
false then, else part is executed, i.e., it replaces the element in the queue by the new element.
Step 8: If the choice is Invalid, then it displays the statement choose the correct option.
SOURCE CODE:
#include<stdio.h>
#include<conio.h> //preprocessor directives
void main()
F-LBM- 23-22K Software Testing Lab
{
int *queue[15],q[15];
int n=0,i=0,opt,s=0,newval,size; //variable
declaration clrscr(); // clearing screen
printf("\n\t\t\t <=QUEUE OPERATIONS=>");
printf("\n\t\t\t ====================");
printf("\n\n Enter Size: ");
scanf("%d",&size); //To read size of queue
do
{
printf("\n\n\t MENU\n\t ”);
printf(“\n\n\t 1.Insert"); // Displays menu
printf("\n\n\t 2.Delete\n\n\t 3.List\n\n\t 4.Modify\n\n\t 5.Exit");
printf("\n Enter your choice (1-5): ");
scanf("%d",&opt); //To read choice from menu
switch(opt)
{
case 1: // To insert an element
clrscr();
if(n==size) //If rear reaches maximum size then queue is
full printf("\n Queue Full");
else
{
n++; // Incrementing rear end
printf("\n Enter the new element: ");
scanf("%d",&q[n]); //read new element to insert
queue[n]=&q[n]; //new element is copied to queue
printf("\n The new element %d is added to
queue",q[n]); }
break;
case 2: // To delete an element
clrscr();
if(n==0) //If front is zero then queue empty
F-LBM- 23-22K Software Testing Lab
OUTPUT :-
Enter Size: 3
MENU
1.Insert
2.Delete
3.List
4.Modify
5.Exit
F-LBM- 23-22K Software Testing Lab
Queue:(front) 77 3 (Rear)
Enter your choice (1-5): 5
F-LBM- 23-22K Software Testing Lab
Ex.No: 7
To test the C++ program: Palindrome string checking program using pointers.
ALGORITHM:
Step 1: Declare two variables s and r and two pointer variables strt and estr of any
Step 5: Using for loop, swap the variable to temporary variable ch.
Step 6: The values of s is assigned to pointer variable strt. The values of r are assigned to pointer
variable rstr.
Step 9: If the condition is true, display strt is not a palindrome, else display strt is a palindrome.
SOURCE CODE:
#include<iostream.h> #include<conio.h>
void main()
{
char str1[20],str2[20],*s,*rs;//Declare the variables
clrscr();
cout<<"\n\n Enter a string:"; cin>>str1;//Read the
character string
strcpy(str2,str1);//Copy the first string to the second string
s=str1;
TC-03 Enter the string. Accept the value. It should Value accepted. SUCCESS
accept the
value.
TC-04 Get the length String length It should give Produced the SUCCESS
of the string. is calculated. the string string length.
length.
TC-05 Get duplicate Copy the It should copy Copied the SUCCESS
copy of the string from the string from string from
string. original to original to original to
reversed. reversed. reversed.
TC-09 Process case: Using for() The string The string is SUCCESS
For() loop. loop reverse Should be reversed.
the string. reversed.
OUTPUT :-
ENHANCEMENT:
Ex. No. 1:
AIM:
To develop test cases for the C++ program using white box testing: To find the week day
from a given date.
ALGORITHM:
Step 3: Using multi-way decision making statement, check the number given in variable n.
Step 4: If the given option is true, display the corresponding day given, else if the number is
invalid, display it as Invalid number.
Step 5: For the given decision making statement, develop the multiple condition coverage testing
for all cases.
4
123 5
6
SOURCE CODE:
#include<iostream.h>
#include<conio.h>
int main()
{
int n;
cout<<”Enter number for day:
“; cin>>n;
switch(n)
{
case 1: cout<<”Sunday”; break;
case 2:
cout<<”Monday”;
break;
case 3:
cout<<”Tuesday”;
break;
case 4:
cout<<”Wednesday”;
break;
case 5:
cout<<”Thursday”;
break;
F-LBM- 23-22K Software Testing Lab
case 6:
cout<<”Friday”;
break;
case 7:
cout<<”Saturday”;
break;
default:
cout<<”Invalid
number!”; break;
}
return 0;
}
TEST CASES:
TC-02 Enter the number. Accept the value. It should Value accepted. SUCCESS
accept the
value.
TC-03 Process case: Using Case Depends on the Print the Day. SUCCESS
Case structure. structure its n value the day
checks the n will matched.
value.
TC-04 Process case: Using Case Depends on the Invalid n value. FAILURE
Case structure. structure its n value the day
checks the n will matched.
value.
TC-05 This method is Checks the n Executes the Days will be SUCCESS
designed to value to select selected path executed
execute all or the path. which matches
selected path. the value
TC-06 This method is Checks the n Executes the Executes the FAILURE
designed to value to select default path. invalid number
execute all or the path.
selected path.
F-LBM- 23-22K Software Testing Lab
OUTPUT:
Enter number for day:1
Sunday
Ex. No. 2:
Scope:
The document only covers the requirements specifications for the Library Management System.
This document does not provide any references to the other component of the Library
Management System. All the external interfaces and the dependencies are also identified in this
document.
Feasibility study:
The overall scope of the feasibility study was to provide sufficient information to allow a
decision to be made as to whether the Library Management System project should proceed and if
so, its relative priority in the context of other existing Library Management Technology.
The feasibility study phase of this project had undergone through various steps which as describe
as under:
F-LBM- 23-22K Software Testing Lab
Overview:
The implementation of Library Management starts with entering and updating master records
like book details, library information. Any further transaction like book issue, book return will
automatically update the current books.
Overall Description:
Product Perspective:
The proposed Library Management System will take care of the current book detail at any point
of time. The book issue, book return will update the current book details automatically so that
user will get the update current book details.
Product function:
User characteristics:
They have 2 levels of users:
• User module: In the user module, user will check the availability of the books. •
Book return
• Administration module: The following are the sub module in the administration module. •
Register user
• Entry book details
• Book issue
General Constraints:
Any update regarding the book from the library is to be recorded to have update & correct
values.
Assumption and dependencies:
All the data entered will be correct and up to date. This software package is developed using java
as front end which is supported by sun micro system. Microsoft SQL server 2005 as the back end
which is supported by Window 7.
Specific Requirement:
External Interface Requirement:
The user should be simple and easy to understand and use. Also be an interactive interface .The
system should prompt for the user and administrator to login to the application and for proper
input criteria
F-LBM- 23-22K Software Testing Lab
User Interface:
The software provides good graphical interface for the user any administrator can operate on the
system, performing the required task such as create, update, viewing the details of the book.
• Allows user to view quick reports like Book Issues/Returned etc in between particular time. •
Stock verification and search facility based on different criteria.
Hardware interface:
Software interface :
• Java language
• Net beans IDE 7.0.1
• MS SQL server 2005
Communication interface:
• Window
Functional requirements:
• Book entry: In this module we can store the details of the books.
• Register student: in this module we can keep the details of the newstudent. •
Book issue: This module is used to keep a track of book issue details. • Book
return: This module enables to keep a track of return the books.
Performance requirements:
The capability of the computer depends on the performance of the software. The software
can take any number of inputs provided the database size is larger enough. This would depend on
the available memory space.
Design constraints:
Each member will be having a identity card which can be used for the library book issue,
fine payment etc. whenever library member wish to take a book, the book issued by the library
authority will be check both the book details as well as the student details and store it in library
database. In case of retrieval of book much of human intervention can be eliminated.
System Attributes:
• Maintainability: There will be no maintained requirement for the software. The database is
provided by the end user and therefore is maintained by this user.
• Portability: The system is developed for secured purpose, so it is can’t be portable. •
Availability: This system will available only until the system on which it is install, is running.
• Scalability: Applicable.