0% found this document useful (0 votes)
4 views41 pages

ST Lab

The document outlines the Software Testing Lab curriculum for the III B.Sc Computer Science students at L.R.G. Government Arts College for Women, detailing various programming tasks and their corresponding test cases. It includes examples of C programs for calculating the sum of digits, generating prime numbers, and creating a student marksheet, along with the algorithms and expected outcomes for each task. The lab work is intended to prepare students for practical examinations and enhance their programming skills.

Uploaded by

kiruthigasree9
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)
4 views41 pages

ST Lab

The document outlines the Software Testing Lab curriculum for the III B.Sc Computer Science students at L.R.G. Government Arts College for Women, detailing various programming tasks and their corresponding test cases. It includes examples of C programs for calculating the sum of digits, generating prime numbers, and creating a student marksheet, along with the algorithms and expected outcomes for each task. The lab work is intended to prepare students for practical examinations and enhance their programming skills.

Uploaded by

kiruthigasree9
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

L.R.

G GOVERNMENT ARTS COLLEGE FOR WOMEN


(Affiliated To Bharathiar University)

TIRUPUR–641 604.

DEPARTMENT OF COMPUTER SCIENCE

SKILL BASED SUBJECT LAB : IV

SOFTWARE TESTING LAB

NAME :

[Link] :

CLASS : III [Link] SHIFT: I

SUBJECT : SOFTWARE TESTING LAB


L.R.G. GOVERNMENT ARTS COLLEGE FOR WOMEN
(Affiliated To Bharathiar University)

TIRUPUR–641 604.

Name :

RegisterNo :

Class : III [Link] Shift: I

This is to certify that it is a Bonafide record of work done by the above

Student of the [Link]. Computer Science. SKILL BASED SUBJECT LAB – IV

SOFTWARE TESTING LAB during the academic year 2024-2025.

Staff in Charge Head of the Department

Submitted for the Bharathiar University Practical Exam held on………….

Internal Examiner External Examiner


INDEX

[Link] DATE CONTENT PAGE NO SIGNATURE

11.12.2024 SUM OF THE DIGITS


1.

2. 13.12.2024 STUDENT MARKSHEET

30.12.2024 GENERATION OF
3.
PRIME NUMBERS

4. 13.01.2025 MERGED SORTED LIST

5. 20.01.2025 STACK OPERATION

6. 06.02.2025 QUEUE OPERATION

7. 18.02.2025 STRING PALINDROME


1. SUM OF THE DIGITS

AIM :

To write the C program finding the sum of individual digits of 10 digits number

until a single digit is produced test the C program.

ALGORITHM :

STEP 1 : Start with a number n.

STEP 2 : Set the sum to 0.

STEP 3 : While n is greater than 0

STEP 4 : Get the last digit: digit = n % 10.

STEP 5: Add the digit to the sum: sum = sum + digit.

STEP 6 : Remove the last digit: n = n // 10.

STEP 7 : End the loop when n becomes 0.

STEP 8 : The sum is now stored in the sum variable.

STEP 9 : Output the sum.


TEST CASES :

TEST TEST TEST EXPECTED ACTUAL STATUS


ID DESCRIPTION STEPS RESULT RESULT
TC-01 Input field accept the Enter the numeric Accept the input Achieved Success
numeric data data(123) data result(6) result
TC-02 Input field should not Enter the alphabet Not accepted input Not accept Success
accept the alphabet eg(ABC) data alphabet
TC-03 Input field accept Enter the numeric Accepted single Achieved Success
single digit value eg(2) digit value result
TC-04 Input field accept 3 Enter the numeric Accepted 3-digit Achieved Success
digit value eg(4,5,6) value(6) result
TC-05 Input field accept 5 Enter the numeric Accepted 5-digit Achieved Success
digit value eg(1,2,3,4,5) value(6) result
TC-06 Input field accept 7 Enter the numeric Accepted 7-digit Achieved Success
digit value value(1) result
eg(1,2,3,4,5,6,7)
TC-07 Input field accept 9 Enter the numeric Accepted 9-digit Achieved Success
digit value value(9) result
eg(1,2,3,4,5,6,7,8,9
)
TC-08 Input field not accept Enter the negative Not accept the Negative not Success
negative value value eg(-2,-1) negative value accepted
TC-09 Input 10-digit number Enter the numeric Accept 10-digit Achieved Success
value(1,2,3,4,5,6,7, sum or single digit result
8,9,10) value(1)
TC-10 Input field not accept Not enter accept Blank space not Blank space Success
blank space blank space accept not accepted
/**1. SUM OF THE DIGITS**/
#include<stdio.h>

#include<conio.h>

void main()

long sum;

int dig,num;

clrscr():

printf(“ENTER 10 DIGIT NUMBER:”);

scanf(“%ld”,&num);

do

sum=0;

while(num!=0)

dig=num%10;

sum+=dig;

num/=10;

num=sum;

while(num/10!=0);

printf(“THE SUM IS:%d”,sum);

getch();

}
OUTPUT :

RESULT:

Thus the C program has been complied and executed successfully.


2. STUDENT MARKSHEET

AIM :

To test the C program : sort and store the elements of two array of integer into
third elements.

ALGORITHM :

STEP 1 : Start the Process

STEP 2 : Start by collecting the student's name, roll number, and marks for each

subject.

STEP 3 : Initialize total marks as 0 and set the number of subjects.

STEP 4 : Input the marks for each subject and calculate the total.

STEP 5 : Calculate the percentage using the formula: percentage =

(total_marks / maximum_marks) * 100.

STEP 6 : Check if the student has passed by comparing if the marks in each subject are

above the passing mark (e.g., 40% for each subject).

STEP 7 : Display the result as "Pass" if all subjects are above the passing mark;

otherwise, display "Fail".

STEP 8 : End the process.


TEST CASES :

TEST TEST TEST EXPECTED ACTUAL STATUS


ID DESCRIPTION STEPS RESULT RESULT
Input the
Input field not accept Not accept the
TC-01 numeric Not accepted Success
the numeric data numeric data
data(Eg:123)
Input student name, Input more than Character length
TC-02 Not matched Success
length of the character 20 character is not matched
Input field accept the
TC-03 Input the name Accept the name Accepted Success
character
Input the
Input field not accept number of Not accepted
TC-04 Not accepted Success
more than 5 subjects subjects more MAX limit
than 5(Eg:7)
Input the Accepted the
Input field accept 5
TC-05 number of number of Accepted Success
subjects
subjects(Eg:5) subjects
Input the Accept the value
Input field accept the 5
TC-06 value(Eg:50,60, (Eg:50,60,77,99, Accepted Success
subject marks
77,99,98) 98)
Input the
Input field not accept negative Not accept the
TC-07 Not accepted Success
the negative value value(Eg:50,60, negative value
77,99,98)
Input field
Input field not accepted Not accept the
TC-08 values(Eg:50,60, Not accepted Success
for float value float value
77,99,98)
Input Not accepted
Input field accept more
TC-09 marks(Eg:60,80, more than 5 Not accepted Success
than 5 values
90,77,80,35) values
To check the else Input
Student result is Achieved
TC-10 condition marks then values(Eg:35,39, Success
fail result
the result is fail 26,18,20)
/**[Link] MARKSHEET**\
#include<stdio.h>
#include<conio.h>
struct s1
{
char na[50];
int m1,m2,m3,m4,m5,t,rno;
float a;
};
main()
{
struct s1 s;
do
{
clrscr();

printf("\n\n\t\t STUDENT MARKLIST PREPARATION");

printf("\n\n\t\t *********************");

printf("\n\n\t\t ENTER THE NAME :");

scanf("%s",&[Link]);

printf("\n\n\t\t ENTER THE ROLLNO :");

scanf("%d",&[Link]);

printf("\n\n\t\t ENTER THE MARK1 :");

scanf("%d",&s.m1);

printf("\n\n\t\t ENTER THE MARK2 :");

scanf("%d",&s.m2);

printf("\n\n\t\t ENTER THE MARK3 :");

scanf("%d",&s.m3);

printf("\n\n\t\t ENTER THE MARK4 :");


scanf("%d",&s.m4);

printf("\n\n\t\t ENTER THE MARK5 :");

scanf("%d",&s.m5);

s.t=s.m1+s.m2+s.m3+s.m4+s.m5;

s.a=s.t/5.0;

clrscr();

printf("\n\n\t\t STUDENT MARKLIST PREPARATION");

printf("\n\n\t\t ***************************");

printf("\n\n\t\t Name\t%s",[Link]);

printf("\n\n\t\t [Link]\t%d",[Link]);

printf("\n\n\t\t Mark1\t%d",s.m1);

printf("\n\n\t\t Mark2\t%d",s.m2);

printf("\n\n\t\t Mark3\t%d",s.m3);

printf("\n\n\t\t Mark4\t%d",s.m4);

printf("\n\n\t\t Mark5\t%d",s.m5);

printf("\n\n\t\t Total\t%d",s.t);

printf("\n\n\t\t Average\t%.2f",s.a);

if(s.m1<40||s.m2<40||s.m3<40||s.m4<40||s.m5<40)

printf("\n\n\t\t THE RESULT IS FAIL");

else

printf("\n\n\t\t THE RESULT IS PASS");

printf("\n\n\t\t Continue...(y/n)");

while(tolower(getche())=='y');

return;

}
OUTPUT :
RESULT :

Thus the C program has been complied and executed successfully.


3. GENERATION OF PRIME NUMBERS

AIM :

To test the C program : Program for generating a prime numbers.

ALGORITHM :

STEP 1: Start with a number n (e.g., starting from 2).

STEP 2 : Check if n is greater than 1. If not, move to the next number.

STEP 3 : Loop through numbers from 2 to n-1.

STEP 4 : Check if n is divisible by any number in the loop.

STEP 5 : If divisible, n is not prime, so go to Step 6.

STEP 6 : If n is not divisible by any number in the loop, mark n as prime.

STEP 7 : Move to the next number and repeat the process.

STEP 8 : End when all desired prime numbers are found.


TEST CASES:

TEST TEST EXPECTED ACTUAL


TEST STATUS
DESCRIPTION STEPS RESULT RESULT
ID
To check the
Input the Accept the Number are
TC-01 acceptance of Success
number number accepted
numeric value
To check non- Input the Not acceptance Character
TC-02 Success
acceptance value character of the character not accepted
To check non- Input the
Not accepted the Achieved
TC-03 acceptance of special special Success
special character result
character character
Input the
To check non- number Not accepted the Not
TC-04 acceptance integer exceed the integer value accepted Success
value of given range maximum beyond limit beyond limit
given range
Input the
To check the number not Accept the input Achieved
TC-05 Success
acceptance integer exceed the value(E.g:15) result
maximum
Input the
To check non- Not print
number & Do not print the
TC-06 acceptance negative prime Success
check the prime number
value number
condition
To ensure the number Input the
is divisible by itself number & Print the prime Achieved
TC-07 Success
& generative prime check the number result
numbers condition
To ensure that input
Enter the Not accept the Blank space
TC-08 field should not Success
blank space blank space not accepted
accept blank space
To check the non- Enter the
Not accept the Float value
TC-09 acceptance of float input float Success
float value not accepted
number value
Accept the
To check the
Enter the number & Achieved
TC-10 condition expression Success
number(E.g:5) display prime result
p[i]=p
number
/**[Link] OF PRIME NUMBERS**/

#include<stdio.h>

#include<conio.h>

void main()

int a,b,c=0,r;

clrscr();

printf("Enter Range:");

scanf("%d",&r);

a=1;

while(a<=r)

b=1;c=0;

while(b<=a)

if(a%b==0)

c=c+1;

b++;

if(c==2)

printf("\n %d is a prime number",a);

a++;

getch();

}
OUTPUT :

RESULT :

Thus the C program has been complied and executed successfully.


4. MERGED SORTED LIST

AIM :

To test the C Program: Sort and store the elements of two array of integer into

third elements.

ALGORITHM :

STEPS 1 : Initialize two pointers at the start of both lists.

STEPS 2 : Compare the elements at both pointers.

STEPS 3 : Add the smaller element to the result list.

STEPS 4 : Move the pointer forward in the list from which the element was taken.

STEPS 5 : Repeat steps 2–4 until one list is exhausted.

STEPS 6 : Add the remaining elements from the other list to the result.

STEPS 7 : Return the merged list.


TEST CASES:

TEST TEST TEST EXPECTED ACTUAL STATUS


ID DESCRIPTION STEPS RESULT RESULT
To check that
Enter the input
TC-01 acceptance of numeric Accepted Accepted Success
value (E.g:3)
for the size of 1st array
To check that
acceptance of numeric Enter the input
TC-02 Accepted Accepted Success
value for the size of 2nd value(E.g:3)
array
To check that the array
Enter the input
TC-03 in out of boundary for Not accepted Not accepted Success
value(E.g:11)
1st array
To check that the array
Enter the input
TC-04 is out of boundary for Not accepted Not accepted Success
value(E.g:12)
2nd array
To check that the non
Enter the input
TC-05 acceptance negative Not accepted Not accepted Success
value (E.g:-3)
value for 1st array
To check that non
Enter the input
TC-06 acceptance a negative Not accepted Not accepted Success
value(E.g:-3)
value for 2nd array
To check that the array
Enter the input Ascending Ascending
TC-07 of 1st is given Success
value(E.g:123) order(E.g:123) order(E.g:123)
ascending order
To check that the array
Enter the input Ascending Ascending
TC-08 of 2nd array is given Success
value(E.g:451) order(E.g:145) order(E.g:145)
ascending order
Entered value
To check that two array 1st A flow A flow
TC-09 Success
are merged correctly array[123]2nd merged[12345] merged[12345]
array[145]
Given an
To check that the It gives a
statement like It gives a control
TC-10 control transfer failure control transfer Success
that „break‟ in transfer failure
on 1st array failure
your 1st array
/**4. MERGED SORTED LIST**\

#include<stdio.h>

#include<conio.h>

#include<math.h>

void main()

int m,n,p,sum=0;

int listA[5],listB[5],listC[10]={0};

clrscr();

printf("\n Enter the Elements for First List\n\n");

for(m=0;m<5;m++)

scanf("%d",&listA[m]);

if(listA[m]==0)

m--;

sum=sum+abs(listA[m]);

printf("\n Enter the Elements for Second List\n\n");

for(n=0;n<5;n++)

scanf("%d",&listB[n]);

if(listB[n]==0)

n--;

sum=sum+abs(listB[n]);

}
p=n=m=0;

m=n-sum;

while(m<sum)

for(n=0;n<5;n++)

if(m==listA[n]||m==listB[n])

listC[p++]=m;

if(m==listA[n]&&m==listB[n])

listC[p++]=m;

m++;

puts("Merged Sorted List:\n\n\n");

for(n=0;n<10;n++)

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

getch();

}
OUTPUT :

RESULT :

Thus the C program has been complied and executed successfully.


5. STACK OPERATION

AIM :

To create a stack using array and to perform stack generation such as push,pop.

ALGORITHM :

STEP 1 : First, initialize an empty stack to hold elements.

STEP 2 : To add an element, use the push operation, which places the element at the

top of the stack.

STEP 3 : To remove an element, use the pop operation, which removes and returns the

element from the top.

STEP 4 : If you just want to view the element at the top without removing it, use the

peek operation.

STEP 5 : You can check if the stack is empty using the isEmpty function, which returns

True if there are no elements.

STEP 6 : The size operation tells you how many elements are currently in the stack.

STEP 7 : Finally, if you want to clear the stack, use the clear operation, which

removes all elements, leaving the stack empty.


TEST CASES:

TEST TEST TEST EXPECTED ACTUAL STATUS


ID DESCRIPTION STEPS RESULT RESULT
To ensure that input
Enter the numeric Accept numeric Accept
TC-01 field accept the Success
data(E.g:5) data(E.g:5) numeric data
numeric data
To ensure that input Enter the Negative
Do not accept
TC-02 field not accept the negative value not Success
negative value
alphabet value value(E.g:3) accepted
To ensure that field not Enter the
Do not accept Alphabet not
TC-03 accept the alphabet alphabet Success
the alphabet accepted
value value(E.g:abc)
To ensure that input Do not accept Special
Enter the special
TC-04 field not accept the the special character not Success
character(E.g:#,$)
special character character accepted
To ensure that element Enter the choice Insert the Element
TC-05 Success
inserted in user choice all element inserted
To ensure that element Enter the choice Enter the Element
TC-06 Success
deleted in user choice as 2 element deleted
To ensure that the
Enter the choice Terminate the Program
TC-07 program terminated in Success
as 3 program terminated
user choice
Enter the choice
Display the
To check the stack all and insert the Archived
TC-08 message “stack Success
is full element untill result
is full”
stack is full
Enter the choice Display the
To check the stack is Archived
TC-09 has 2 until the message “Stack Success
empty result
stack empty is empty”
Display the
To check the program message the
Enter the choice Archived
TC-10 execution as per user choice is wrong Success
above 3(E.g:4) result
choice input correct
choice
/**5. STACK OPERATION**\

#include<stdio.h>

#include<conio.h>

#include<string.h>

const int size=5;

void main()

int ch;

int top=0,stack[5],c,i,e;

clrscr();

label:

printf("\n\t Stack Operation");

printf("\n\t ***************");

printf("\n\t [Link] \n\[Link]\n\[Link]\n\[Link]\n\t");

printf("\n\t Enter your choice:\t");

scanf("%d",&c);

switch(c)

case 1:

if(top==5)

printf("\n Stack is full\n");

Else
{

top=top+1;

printf("\n\t Enter the element:\t");

scanf("%d",&e);

stack[top]=e;

printf("\n\t The Pushed Element is:%d",stack[top]);

break;

case 2:

if(top==0)

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

else

printf("\n\t The popped element is:%d",stack[top]);

top=top-1;

break;

case 3:

if(top>0)

printf("\n\t The element in the List is \n");

for(i=top;i>=1;i--)

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

else

printf("\n\t The Stack is Empty");

break;

case 4:

exit(1);

break;

printf("\n\n Do you want to continue:");

scanf("%d",&ch);

if(ch==1)

goto label;

getch();

}
OUTPUT :
RESULT :

Thus the C program has been complied and executed successfully.


6. QUEUE OPERATION

AIM :

To test the C Program as menu driven operation as add, remove and display.

ALGORITHM :

STEPS 1 : Initialize the queue as an empty structure.

STEPS 2 : Enqueue an element by adding it to the rear of the queue.

STEPS 3 : Dequeue an element by removing and returning the front element.

STEPS 4 : Peek at the front element without removing it to see what‟s next in line.

STEPS 5 : Check if the queue is empty using the isEmpty operation, which returns a

boolean.

STEPS 6 : Find the current size of the queue, which tells how many elements it

contains.

STEPS 7 : Clear the queue by removing all elements, leaving it empty.


TEST CASES:

TEST TEST TEST EXPECTED ACTUAL STATUS


ID DESCRIPTION STEPS RESULT RESULT
To ensure the I/P
Enter the numeric Accept the Achieved
TC-01 field accept the Success
value(E.g:5) numeric value result
numeric value
To ensure that I/P
Enter negative Not accept the Achieved
TC-02 field not accept Success
value(E.g:5) negative value result
negative
Input not accept the Enter the Not accept the Achieved
TC-03 Success
alphabet value alphabet(E.g:abcd) alphabet result
To ensure the
Enter the Insert the Element is
TC-04 element inserted in Success
choice(E.g:1) element inserted
user choice
To ensure the
Enter the Delete the Element is
TC-05 element deleted in Success
choice(E.g:2) element deleted
user choice
To ensure that
Enter the Terminate the Program is
TC-06 terminal in user Success
choice(E.g:3) program terminated
choice
Display the
To check the stack is Enter the element Achieved
TC-07 message “stack Success
full and still stack is full result
is full”
Enter the choice Display the
To check the stack is Achieved
TC-08 2,until stack is message “stack Success
empty result
empty is empty”
To check the Display the
Enter the choice Achieved
TC-09 program execution as message “wrong Success
above 3 result
per user choice output”
Program
To check the Enter the data type Program not
TC-10 executed Success
declaration statement as float executed
correctly
/**6. QUEUE OPERATION**\

#include<stdio.h>

#include<conio.h>

void main()

int c=0,i,b,front=0,rear=0,n=10;

int*ptr[5];

clrscr();

printf("\n\t INPUT");

printf("\n\t *****");

printf("\n\t [Link]");

printf("\n\t [Link]");

printf("\n\t [Link]");

printf("\n\t [Link]");

printf("\n\t **************");

while(c!=5)

printf("\n ENTER THE CHOICE:");

scanf("%d",&c);

switch(c)

case 1:

if(rear==n)

printf("\n\t QUEUE IS FULL");

else
{

printf("\n\t Enter the element:");

scanf("%d",&b);

printf("\n Position:%d,Inserted Value:%d",rear+1,b);

*ptr[rear]=b;

rear++;

break;

case 2:

if(front==rear)

printf("\n\t QUEUE IS EMPTY");

else

b=*ptr[front];

printf("\n\t **************");

printf("\n\t%d is the Deleted Element\n",b);

printf("\n ****************");

front=front++;

break;

case 3:

if(front==rear)

printf("\n\t QUEUE IS EMPTY");

else

{
printf("\n\t The List in the Queue:");

for(i=front;i<rear;i++)

printf("\n\n\t%d",*ptr[i]);

break;

case 4:

exit(0);

}
OUTPUT :
RESULT :

Thus the C program has been complied and executed successfully.


7. STRING PALINDROME

AIM :

To test the C++ program for palindrome string checking program (using pointers).

ALGORITHM :

STEP 1 : Start with the sentence you want to check for being a palindrome.

STEP 2 : Create a new string by reversing the cleaned-up sentence.

STEP 3 : Check if the original normalized sentence is the same as the reversed

version.

STEP 4 : Output True if it's a palindrome, otherwise False.

STEP 5 : End the Process.


TEST CASES:

TEST TEST TEST EXPECTED ACTUAL STATUS


ID DESCRIPTION STEPS RESULT RESULT
To check the
Input the Achieved
TC-01 acceptance of string It accept the string Success
string(E.g:madam) result
to input field
To check the non- It display the
Input the Achieved
TC-02 acceptance of message “Invalid Success
numeric(E.g:2) result
numeric value input”
To check the non- Input the non- It display the
Achieved
TC-03 acceptance of acceptance of message “Invalid Success
result
special character special character input”
To check the
control transfer if It display the
Input the Achieved
TC-04 condition it does message “Invalid Success
numbers(E.g:25) result
not accept the input”
number
To check the
control transfer if It display the
Input the Achieved
TC-05 condition accept message the “Given Success
string(E.g:madam) result
string reverse it to string is palindrome”
check palindrome
To check the output
It display message
print ”Numbers not Input the Achieved
TC-06 “Numbers not Success
accept “when input number(E.g:2,4,3) result
accepted”
alphabets
To check the output
It display message
print ”Special Input the special Achieved
TC-07 “Special characters Success
characters not character(E.g:#,@) result
not accepted”
accepted”
To check the output
It display message
print “The given Enter the Achieved
TC-08 “The given string is Success
string is string(E.g:Madam) result
palindrome”
palindrome”
To check the output
It display message
print “The given Enter the Achieved
TC-09 “The given string is Success
string is not a string(E.g:Sir) result
not a palindrome”
palindrome”
To check the input
field does not Enter the negative It display message Achieved
TC-10 Success
accept negative value(E.g:-3) “Invalid input” result
value
/**7. STRING PALINDROME**\

#include<iostream.h>

#include<conio.h>

#include<string.h>

class palindrome

public:

void check();

};

void palindrome::check()

char*str,*rev;

int i,j,len;

cout<<"\n\n PALINDROME";

cout<<"\n\n ***********";

cout<<"\n\n Enter the string:";

cin>>str;

len=strlen(str);

cout<<"\n\n The Length Of The String Is:"<<len;

j=0;

for(i=len-1;i>=0;i--)

rev[i]=str[j];

j++;
}

rev[j]='\0';

cout<<"\n\n ENTERED STRING IS:"<<str;

cout<<"\n\n REVERSED STRING IS:"<<rev;

if(strcmp(str,rev)==0)

cout<<"\n\n THE STRING"<<str<<" IS A PALINDROME";

else

cout<<"\n\n THE STRING"<<str<<" IS NOT A PALINDORME";

void main()

clrscr();

palindrome pp;

[Link]();

getch();

}
OUTPUT :

RESULT :

Thus the C program has been complied and executed successfully.

You might also like