0% found this document useful (0 votes)
0 views

SOFTWARE TESTING Lab Manual

The document is a lab manual for a Software Testing Lab course in a Computer Science program, detailing program outcomes, specific outcomes, course objectives, and a list of practical exercises. It includes algorithms, source code, and test cases for various C and C++ programs, such as calculating the sum of digits, checking student results, and generating prime numbers. The manual emphasizes the development of programming skills, software quality practices, and the ability to write effective documentation and reports.

Uploaded by

gamercrazy767
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

SOFTWARE TESTING Lab Manual

The document is a lab manual for a Software Testing Lab course in a Computer Science program, detailing program outcomes, specific outcomes, course objectives, and a list of practical exercises. It includes algorithms, source code, and test cases for various C and C++ programs, such as calculating the sum of digits, checking student results, and generating prime numbers. The manual emphasizes the development of programming skills, software quality practices, and the ability to write effective documentation and reports.

Uploaded by

gamercrazy767
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 42

F-LBM- 23-22K Software Testing Lab

DEPARTMENT OF COMPUTER SCIENCE

III – B.Sc CS

VI SEMESTER

SOFTWARE TESTING LAB

LAB MANUAL

SKILL BASED SUBJECT - 4 : SOFTWARE TESTING LAB

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.

PROGRAMME SPECIFIC OUTCOME

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.

ii) Databases, Software Engineering and Development.


iii) Apply problem solving skills and the expertise in solving real world problems.
PSO-3 To prepare the students to become, well educated, ethical and responsible citizens.

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

1. To construct and test logical validations in simple C and C++ programs.


2. To write manual test cases for the given functionality in the specified format for Unit
testing in projects.

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:

1. Knowledge about basic C and C++ programming constructs.


F-LBM- 23-22K Software Testing Lab

Ex.No.01

SUM OF INDIVIDUAL DIGITS

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:

Step 1: Start the process.

Step 2: Open TC present in the program files to open the C programming

environment.

Step 3: Declare the variables required inside the main function.

Step 4: Get 10 digits from the user which is stored in the variable called temp for
temporary storage.

Step 5: Performing the operations of sum of individual digits given by theuser.

Step 6: Sum of individual digit is displayed finally using display function.

Step7 : Stop the process.


F-LBM- 23-22K Software Testing Lab

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

TEST TEST TEST STEPS EXPECTED ACTUAL STATUS


ID DESCRIPTION OUTPUT OUTPUT

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-05 Output case 1. Title of the 1. Addition of 1. Addition of SUCCESS


check for the program. digits in a no. digits in a no.
formatted output. 2. Input query. 2. Enter the 2. Enter the
3. Output query. number number
4. Line space. <Accept <Accept
number in next number in next
line>. line>.
3. The sum of 3. The sum of
digit number is digit number is
< result. < result.

TC-06 Acceptance of Input 10 digit Accepted 10 Accepted 10 SUCCESS


10 digit input number. Digit number. Digit number.
data.

TC-07 Non-acceptance Input a Character X Character data SUCCESS


of character character data should not be not accepted.
data. ‘X’. accepted.

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-09 Check if Count If it is true then Go to ADD Go to ADD SUCCESS


is less than 10 process go to DIGIT. DIGIT.
(count<10). ADD DIGIT.

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 :-

SUM OF INDIVIDUAL DIGITS

Enter the number: 1234567897

Sum of individual digits are: 7

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 1: Start the process

Step 2: Declare the header file at a top of the program.

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”.

Step 6: Stop the process.

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

Enter the Name: S.KAVITHA

75
60
95
88
78

THE RESULT IS PASS


F-LBM- 23-22K Software Testing Lab

Ex.No.03

GENERATING PRIME NUMBERS

AIM:
F-LBM- 23-22K Software Testing Lab

To test a C program for generating prime numbers to a given number as input.

ALGORITHM:

Step 1: Start the process.

Step 2: Declare the variables as integer for n, i, j, y.

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

value as 0 as 1 to generate the prime numbers.

Step 6: Display the prime numbers generated using print statement.

Step 7: Stop the process.

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:

TEST TEST TEST STEPS EXPECTED ACTUAL STATUS


ID DESCRIPTION OUTPUT OUTPUT

TC-01 Input case Enter the n Accept Input Accepted SUCCESS


Positive. number as when n is an Input is of
integer for integer the type int
generating prime
numbers.

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-05 Output case 1. Title of the PRIME PRIME SUCCESS


Check for the program. FORMAT FORMAT
formatted output. 2. Input query. enters the enters the
3. Output query. respective no. respective
Display prime no. Display
no. prime no.

TC-06 INPUT-CASE Enter the value for n. Accept the value. Accepted the SUCCESS
value.

TC-07 OUTPUT-CASE. Display the The prime The prime SUCCESS


generated prime numbers list number list is
number. will be displayed.
displayed.

OUTPUT :-
Enter the value of n
7

**Prime numbers between 1 to5**

2357

Ex.No: 4

SORTING AND MERGING OF ARRAY ELEMENTS

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 1: Start the process.

Step 2: Declare the variables required inside the main function.

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

array3. Step 7: Stop the Process.

SOURCE CODE

#include<stdio.h>
#define MAX 20

void bubble_sort(int arr[],int size)

int i,j,temp;

for (i = 0; i < size ; i++)

for (j = 0; j <size-1-i; j++)

if (arr[j] > arr[j+1])

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

}/*End of inner for loop*/

}//end of outer loop

void merge(int arr1[],int size1,int arr2[],int size2,int


arr3[]) {
/* Merging */

int i=0; /*Index for first array*/


F-LBM- 20-22K

int j=0; /*Index for second array*/ int


k=0; /*Index for merged array*/

while( (i < size1) && (j < size2) )

if( arr1[i] < arr2[j] )

arr3[k++]=arr1[i++];

else

arr3[k++]=arr2[j++];

}/*End of while*/

/*Put remaining elements of arr1 into arr3*/


while( i < size1 )
arr3[k++]=arr1[i++];

/*Put remaining elements of arr2 into arr3*/


F-LBM- 23-22K Software Testing Lab

while( j < size2 )


arr3[k++]=arr2[j++];

/*Merging completed*/

main()

int arr1[MAX],arr2[MAX],arr3[40];int
i,j,k;
int size1,size2;

printf("Enter the number of elements in list1 :");


scanf("%d",&size1);
printf("Take the elements :\n");
for(i=0;i<size1;i++)
{
F-LBM- 23-22K Software Testing Lab

printf("Enter element %d : ",i+1);


scanf("%d",&arr1[i]);
}

bubble_sort(arr1,size1);

printf("Enter the number of elements in list2 :");


scanf("%d",&size2);
printf("Take the elements :\n");
for(i=0;i<size2;i++)
{

printf("Enter element %d : ",i+1);


scanf("%d",&arr2[i]);
}

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:

TEST TEST TEST STEPS EXPECTED ACTUAL STATUS


ID DESCRIPTION OUTPUT OUTPUT

TC-01 Input case- Input should be Valid Valid SUCCESS


Enter the size an integer
of arrays. value.

TC-02 Input case- If input is float Invalid Invalid SUCCESS


Enter the size or character.
of arrays.
F-LBM- 23-22K Software Testing Lab

TC-03 Input case - Input should be Valid Valid SUCCESS


Enter the an integer
elements of value.
arrays.

TC-04 Input case - If input is float Invalid Invalid SUCCESS


Enter the or character.
elements of
arrays.

TC-05 Process case - It should be in Valid Valid SUCCESS


First and sorted order.
second array
elements
(while
merging).

TC-06 Process case - It should be in valid valid SUCCESS


First and second sorted order.
array elements
(while
merging).

TC-07 Process case - Array elements are Valid Valid SUCCESS


First and second compared and
array elements largest element is
are added to the third
merged. array.

TC-08 Process case - Array elements are Invalid Invalid SUCCESS


First and second compared and
array elements largest element is
are added to the third
merged. array.

TC-09 Output case – Produce Third Valid Valid SUCCESS


Check for the array in sorted
formatted output. order.

TC-10 Output case – Produce Third Valid Valid SUCCESS


Check for the array in unsorted
formatted output. order.

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

To test C program to experiment the operations of a stack using array

implementation.

ALGORITHM:

Step 1: Start the process.

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

check whether the stack is empty using (top==0).

Step 6: Display the elements of stack and use exit() to exit from the

screen. Step 7: Stop the Process.

SOURCE CODE:

#include <stdio.h>
#include <stdlib.h>

#define MAX 10
int STACK[MAX],TOP;

/* display stack element*/


void display(int []);

/* push (insert) item into stack*/


void PUSH(int [],int);

/* pop (remove) item from stack*/


void POP (int []);

void main()

int ITEM=0;
int choice=0;
F-LBM- 23-22K Software Testing Lab

TOP=-1;
while(1)

/*clrscr();*/

printf("Enter Choice (1: display, 2: insert (PUSH), 3: remove(POP)), 4: Exit..:");

scanf("%d",&choice);
switch(choice)

case 1:
display(STACK);
break;
case 2:

printf("Enter Item to be insert :");


scanf("%d",&ITEM);
PUSH(STACK,ITEM);
break;
case 3:
POP(STACK);

break;
case 4:
exit(0);
default:
printf("\nInvalid choice.");
break;
}
F-LBM- 23-22K Software Testing Lab

getch();

}// end of while(1)


}
/* function : display(),

to display stack elements.

*/

void display(int stack[])

int i=0;
if(TOP==-1)
{

printf("Stack is Empty .\n");


return;
}
printf("%d <-- TOP ",stack[TOP]);
for(i=TOP-1;i >=0;i--)
{

printf("\n%d",stack[i]);

printf("\n\n");

}
/* function : PUSH(),

to push an item into stack.


F-LBM- 23-22K Software Testing Lab

*/

void PUSH(int stack[],int item)

if(TOP==MAX-1)

printf("\nSTACK is FULL CAN't ADD ITEM\n");


return;

}
TOP++;
stack[TOP]=item;

}
/* function : POP(),

to pop an item from stack.

*/

void POP(int stack[])

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

TC-01 Input case- It should be an Valid Valid SUCCESS


Enter the size integer value.
of stack.

TC-02 Input case- If input is float Invalid Invalid SUCCESS


Enter the size or character.
of stack.

TC-03 Input case - It should be an Valid Valid SUCCESS


Enter the integer value.
choice to
perform the
specified action.

TC-04 Input case - If input is float Invalid Invalid SUCCESS


Enter the or character.
choice to
perform the
specified action.

TC-05 Process case – Initialize the Valid Valid SUCCESS


INSERTION: top=0 then it is
Enter the choice incremented.
as push.

TC-06 Process case – Initialize the Invalid Invalid SUCCESS


INSERTION: top!=0 then it is
Enter the choice decremented.
as push.

TC-07 Process case – The top Valid Valid SUCCESS


DELETION: decremented by
Enter the choice one and it displays
as pop. the popped element.

TC-08 Process case – The top Invalid Invalid SUCCESS


DELETION: incremented by one
Enter the choice and it displays the
F-LBM- 23-22K Software Testing Lab

as pop. popped element.

TC-09 Output case – If valid choice is Valid Valid SUCCESS


Check for the given perform
formatted output. the specific
task.

TC-10 Output case – If valid choice is Invalid Invalid SUCCESS


Check for the given perform
formatted output. the specific
task.

OUTPUT :-

Enter the size of


stack:3 Stack
Operations
1.Push
2.Pop
3.Show
4.Exit
Enter your choice:1
Enter the item to
push:1

Enter your choice:1


Enter the item to
push:2

Enter your choice:1


F-LBM- 23-22K Software Testing Lab

Enter the item to


push:3

Enter your
choice:1
Stack Overflow

Enter your choice:3


The elements in Stack are 3 2 1
F-LBM- 23-22K Software Testing Lab

Ex.No: 6

QUEUE OPERATIONS

AIM:

To test a C program to experiment the operations of a queue and to perform the


following:

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 2: Read the input for the size of the queue.

Step 3: The queue operation is performed using menu driven program and the menu includes a
number of choice.

1. Insertion, 2. Deletion, 3. Modification, 4. Listing of elements

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.

Step 9: Displays the output.

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

printf("\n Queue Empty");


else
{
printf("\n The Element %d is deleted",q[1]);
for(i=1;i<=n;i++)
{
*queue[i]=*queue[i+1]; //moving all elements one position
front }
queue[i]=0;
n--; // Decrementing rear end
}
break;
case 3: // To list the elements

if(n==0) //If front is zero then queue empty


printf("\n Queue is empty");
else
{
printf("\n Queue:(front)");
for(i=1;i<=n;i++) //To display the elements of queue
printf("%5d",*queue[i]);
printf(" (Rear)");
}
break;
case 4: //To modify the element of queue
if(n==0) //If front is zero then queue empty
printf("\n Queue Empty");
else
{
printf("\n Enter the position of element to be modified:
"); Re_enter:
scanf("%d",&s); //To read the position of queue if(s>n)
/*If position is greater than size of queue it again pass
the control to read valid position*/ {
F-LBM- 23-22K Software Testing Lab

printf("\n Enter position between [p1-%d]",n);


goto Re_enter;
}
printf("\n The element at %d is
%d",s,*queue[s]); printf("\n Enter new element:
");
scanf("%d",&newval); //Read the new element
*queue[s]=newval; //Insert the element in respective
position }
break;
case 5: //To exit from menu
exit(0);
default:
printf("\n Choose correct option");
}
}while(1);
}
TEST CASES:

TEST TEST TEST STEPS EXPECTED ACTUAL STATUS


ID DESCRIPTION OUTPUT OUTPUT

TC-01 Input case- Enter It should be an Valid Valid SUCCESS


the size of queue. integer value.

TC-02 Input case- Enter If input is float Invalid Invalid SUCCESS


the size of queue. or character.

TC-03 Input case -Enter It should be an Valid Valid SUCCESS


the choice to integer value.
perform the
specified action.

TC-04 Input case -Enter If input is float Invalid Invalid SUCCESS


the choice to or character.
perform the
specified action.
F-LBM- 23-22K Software Testing Lab

TC-05 Process case – The rear is Valid Valid SUCCESS


INSERTION: If the incremented.
rear is equal to size
then the queue is
full or else a new
element can be
inserted.

TC-06 Process case – The rear is Invalid Invalid SUCCESS


INSERTION: If the decremented.
rear is equal to size
then the queue is
full or else a new
element can be
inserted.

TC-07 Process case – Remaining Valid Valid SUCCESS


DELETION: If an elements other
element is deleted than first are
from the queue. moved to front.

TC-08 Process case – Remaining Invalid Invalid SUCCESS


DELETION: If an elements other
element is deleted than first are
from the queue moved to front.

TC-09 Output case – If valid choice Valid Valid SUCCESS


Check for the is given
formatted perform the
output. specific task.

TC-10 Output case – If valid choice Invalid Invalid SUCCESS


Check for the is given
formatted perform the
output. Function.

OUTPUT :-
Enter Size: 3

MENU
1.Insert
2.Delete
3.List
4.Modify
5.Exit
F-LBM- 23-22K Software Testing Lab

Enter your choice:1


Enter the new element: 1
The new element 1 is added to
queue
Enter your choice:1
Enter the new element: 2
The new element 2 is added to queue

Enter your choice:1


Enter the new element: 3
The new element 3 is added to queue

Enter your choice:1


Queue Full

Enter your choice: 3


Queue:(front) 1 2 3 (Rear)

Enter your choice : 4


Enter the position of element to be modified:
2 The element at 2 is 2
Enter new element: 77

Enter your choice :3


Queue:(front) 1 77 3 (Rear)

Enter your choice:2


The Element 1 is deleted
Enter your choice: 3

Queue:(front) 77 3 (Rear)
Enter your choice (1-5): 5
F-LBM- 23-22K Software Testing Lab

Ex.No: 7

PALINDROME STRING CHECKING


AIM:

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

size. Step 2: Enter the string and store it in s.

Step 3: Copy the string s or r.

Step 4: The length of the string s

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 7: Display the reversed string.

Step 8: Compare the pointer variable rstr and strt in if statement.

Step 9: If the condition is true, display strt is not a palindrome, else display strt is a palindrome.

Step 10: Invoke the member function using the object.

Step 11: Stop the process.

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;

rs=strrev(str2);//Reverse the string using string reverse function


F-LBM- 23-22K Software Testing Lab

if(strcmp(s,rs)==0)//Compare and display the string


cout<<"\n\n The given string is palindrome";
else
cout<<"\n\n The given string is not a palindrome";
getch();
}
TEST CASES:

TEST TEST TEST STEPS EXPECTED ACTUAL STATUS


ID DESCRIPTION OUTPUT OUTPUT

TC-01 To check the Declare the Character Character SUCCESS


character variable. character variable should variable is
variable. be present. present.

TC-02 To check the Declare the Integer Integer variable SUCCESS


integer variable. Integer variable. variable is present.
should be
present.

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-06 Check the Fetch the It should Produce the SUCCESS


reversed process reverse of the produce the string in
statement. string. string in reverse order.
reverse order.

TC-07 Check the both Both is same it It should Displayed SUCCESS


variable is called display ”IT ”IT IS
original and palindrome. IS PALINDROME”.
reverse. PALINDROME”.

TC-08 Check the both Both is not It should Displayed SUCCESS


variable same it is display “IT “IT IS NOT A
original and called IS NOT A PALINDROME”.
reverse. palindrome. PALINDROME”.
F-LBM- 23-22K Software Testing Lab

TC-09 Process case: Using for() The string The string is SUCCESS
For() loop. loop reverse Should be reversed.
the string. reversed.

TC-10 Process case: Check whether Palindrome. Palindrome. SUCCESS


If condition. the if
statement
Both are not
equal.

TC-11 Process case: Check Not a palindrome. Not a palindrome. SUCCESS


If condition. whether the
if statement
Both are not
equal.

OUTPUT :-

Palindrome or not using pointersEnter


The String : malayalam
The given string is a palindrome

Palindrome or not using pointers

Enter The String : GOD


The given string is not a palindrome

ENHANCEMENT:

Ex. No. 1:

DEVELOP TESTCASES FOR A C++ PROGRAM USING WHITE BOX TESTING

AIM:

To develop test cases for the C++ program using white box testing: To find the week day
from a given date.

ALGORITHM:

Step 1: Start the process.


F-LBM- 23-22K Software Testing Lab

Step 2: Enter the given number in variable n as the given date.

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.

Step 6: Depending on the n values the day will displayed.

Step 7: Stop the process.

FLOW GRAPH CASE STRUCTURE:

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:

TEST TEST TEST STEPS EXPECTED ACTUAL STATUS


ID DESCRIPTION OUTPUT OUTPUT

TC-01 To check the Declare the Integer Integer SUCCESS


integer variable. integer variable. variable variable is
should be present.
present.

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

MULTIPLE CONDITION COVERAGE:


READ N
IF (N= =1)
PRINT “SUNDAY”
IF (N= =2)
PRINT “MONDAY”
IF (N= =3)
PRINT “TUESDAY”
IF (N= =4 )
PRINT “WEDNESDAY”
IF (N= =5)
PRINT “THURSDAY”
IF (N= =6)
PRINT “FRIDAY”
IF (N= =7)
PRINT “SATURDAY”
ELSE
PRINT “INVALID NUMBER”
F-LBM- 20-22K

OUTPUT:
Enter number for day:1
Sunday

Ex. No. 2:

DEVELOP SOFTWARE REQUIREMENT SPECIFICATION DOCUMENT IN IEEE


FORMAT FOR LIBRARY MANAGEMENT SYSTEM.

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

• Identity the origin the information at different level.


• Identity the expectation of user from computerized system.

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:

• The main purpose of this project is to reduce the manual work.


• This software is capable of managing Book Issues, Returns, and Calculating/Managing Fine. •
Generating various Reports for Record-Keeping according to end user requirements.

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:

• Operating system : window


• Hard disk :40 GB
• RAM : 256 MB
• Processor : Pentium(R)Dual-core CPU

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.

You might also like