Print Lab Manual
Print Lab Manual
PRACTICAL RECORD
NAME :
REGISTER NUMBER :
COURSE : MCA
SEMESTER / YEAR : II / I
APRIL 2024
1
SRM Institute of Science and Technology
Ramapuram Chennai
Faculty of Science & Humanities
(A Place for Transformation)
Department of Computer Science and Applications (MCA)
REGISTER NUMBER:
BONAFIDE CERTIFICATE
Submitted for the University Practical Examination held at SRM Institute of Science and Technology, Ramapuram
Chennai on ___________________________
2
SOFTWARE TESTING - PCA20D06J
4 21-01-2024 Test Cases Report for Count the Total Number of Characters, 09
Digits and Special Character in The Given String
11 03-02-2024 Test Cases for Checking the Login Process of Flight Application 26
3
S.No Date TITLE PAGE NO
4
Ex.No:-1 Name:
Date - 19-12-2023 Reg. No. :
AIM: To derive the test cases for largest number among three number
PROGRAM:
#include <stdio.h>
int main( )
{
double n1, n2, n3;
printf("Enter three different numbers: ");
scanf("%lf %lf %lf", &n1, &n2, &n3);
return 0;
}
RESULT:
5
Ex.No: 2 Name:
Date: 19-12-2023 Reg. No. :
AIM:
1. 55 Valid 0, 1, 1, 2, 3, 5, 0, 1, 1, 2, 3, 5, 8, Pass
8, 13, 21, 34, 13, 21, 34, 55
55
3. 0 Valid 0 0 Pass
PROGRAM:
#include <stdio.h>
int main() {
int t1 = 0, t2 = 1, nextTerm = 0, n;
printf("Enter a positive number: ");
scanf("%d", &n);
return 0;
}
RESULT:
6
Ex.No:-3 Name:
Date - 21-01-2024 Reg. No.:
AIM:
7
Program:
#include <stdio.h>
#include <string.h>
int main()
{
char str[100];
int i, len, flag;
flag = 0;
len = strlen(str);
6
return 0;
}
RESULT:
8
Ex.No:- 4 Name:
Date - 21-01-2024 Reg. No :
AIM:
To derive the test cases for counting the total number of character programs.
Test Input Data Type ofTest Expected Output Actual Output Result
ID
Program:
import java.util.Scanner;
9
int i, alph, digi, spl;
alph = digi = spl = 0;
char ch;
8
if(ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z' ) {
alph++;
}
else if(ch >= '0' && ch <= '9') {
digi++;
}
else {
spl++;
}
}
System.out.println("\nNumber of Alphabet Characters = " + alph);
System.out.println("Number of Digit Characters = " + digi);
System.out.println("Number of Special Characters = " + spl);
}
}
RESULT:
Thus the test case for count the total number of characters program are successfully executed.
10
Ex.No:-5 Name:
Date - 09-01-2024 Reg. No:
AIM: To derive test cases for check leap year or not programs.
PROGRAM:
#include <stdio.h>
int main() {
int year;
printf("Enter a year: ");
scanf("%d", &year);
return 0;
}
RESULT:
Thus the test case for checking leap year or not programs are successfully executed.
12
Ex.No:-6 Name:
Date - 09-01-2024 Reg. No. :
ADDITION
1. Enter a number say 5 The given number The given number PASS
will be displayed will be displayed
2. Click the “+” symbol Waits for the Waits for the PASS
number which is to number which is to
be added be added
3. Enter the number say 4 The given number The given number PASS
will be displayed will be displayed
4. Click the “=” symbol The sum of the The sum of the PASS
numbers should be numbers should be
displayed(5+4=9) displayed(5+4=9)
SUBTRACTION
1. Enter a number say 5 The given number The given number PASS
will be displayed will be displayed
2. Click the “-” symbol Waits for the Waits for the PASS
number which is to number which is to
be be
subtracted subtracted
3. Enter the number say 4 The given number The given number PASS
will be displayed will be displayed
13
MULTIPLICATION
1. Enter a number say 5 The given number The given number PASS
will be displayed will be displayed
2. Click the “*” symbol Waits for the Waits for the PASS
number which is to number which is to
be be
multiplied multiplied
3. Enter the number say 4 The given number The given number PASS
will be displayed will be displayed
4. Click the “=” symbol The product of the The product of the PASS
numbers should be numbers should be
displayed (5*4=20) displayed(5*4=20)
DIVISION
1. Enter a number say 8 The given number The given number PASS
will be displayed will be displayed
2. Click the /” symbol Waits for the Waits for the PASS
number which is to number which is to
be divided be divided
3. Enter the number say 4 The given number The given number PASS
will be displayed will be displayed
4. Click the “=” symbol The division of the The division of the PASS
numbers should be numbers should be
displayed (5*4=20) displayed(5*4=20)
RESULT:
14
Ex.No:-7 Name:
Date - 23-01-2024 Reg. No:
AIM:
To derive the test cases for a program that reads three integer values from an input dialog. The
three values represent the length of the sides of the triangle. The program displays a message that
states whether the triangle is scalene, isosceles or equilateral.
4. A test case with three integers greater than zero such that sum of two integers should be
less than the third integer.
7. A test case with three integers greater than zero such that sum of two is equal to third.
8. Test cases for all three permutations where the length of one side is equal to the sum of the
lengths of other two sides.
15
(b) (3,2,5) Invalid Invalid Triangle Invalid Triangle Pass
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
float a,b,c;
float k=0,l,m;
clrscr();
printf("Enter the value of a b c\n");
scanf("%f%f%f",&a,&b,&c);
k=a+b;
l=b+c;
m=c+a;
if((k>c) && (l>a) && (m>b)) {
}}
}
else
{
15
printf("invalid triangle");
}
getch();
}
16
RESULT:
Thus the test cases for triangle program are successfully executed.
17
Ex.No:-8 Name:
Date - 23-01-2024 Reg. No. :
AIM:
18
Program
#include<stdio.h>
#include<conio.h>
void main()
{
int arr[20]={11,25,36,47,50};
int mid,lower=0,upper=4,num,flag=1;
clrscr();
printf(“\nEnter the number to search”);
scanf(“d”,&num);
for(mid=(lower+upper)/2;lower<=upper;mid=(lower+upper)/2) {
if(arr[mid]==num)
{
printf(“\nThe element is found %d”,mid); flag=0;
break;
}
if(arr[mid]>num)
upper=mid-1;
else
lower=mid+1;
}
if(flag)
printf(“\nElement not found in the list”);
getch();
}
Result :
19
Ex.No:-9 Name:
Date - 30-01-2024 Reg. No. :
TEST CASES FOR SORTING PROGRAM
AIM:
7. 5 Valid 5 5 Pass
20
Program
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,n,a[10],temp=0;
clrscr();
printf(“*****Bubble Sort*****”);
printf(“\nEnter no. of items\n”);
scanf(“%d”,&n);
printf(“\nEnter the array items\n”);
for(i=0;i<n;i++)
scanf(“%d”,&a[i]);
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(a[i]>a[j])
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
printf(“Sorted values are\n”);
for(i=0;i<n;i++)
printf(“\n%d”,a[i]);
getch();
}
RESULT:
Thus the test cases for sorting program are successfully executed.
21
Ex.No:-10 Name:
Date - 03-02-2024 Reg. No. :
LOGIN FORM
AIM
To identify Test case for Login Form
User_name
User_name should accept alphanumeric.
Password
Password should accept alphanumeric.
FORM DESIGN
21
22
CODE
LOGIN FORM
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
}
}
23
HOME FORM
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
OUTPUT:
RESULT:
Thus all the test cases are successfully executed.
24
Ex.No:-11 Name:
Date - 03-02-2024 Reg. No:
AIM:
The agent name must be four characters long. The agent name can be alphabetic, numeric,
alphanumeric, special characters or the combination of all the above. The password should be
case sensitive and the password is ‘mercury’ .
2. Enter the Username : Agent name must Agent name must PASS
abc Enter Password : be at least 4 be at least 4
mercury characters long characters long
25
9. Enter the Username : Abcd Incorrect Incorrect PASS
Enter Password : password. Please password. Please
MERCURY try again try again
10. Enter the Username : bcc Agent name must Agent name PASS
Enter Password : mercury be at least 4 must be at least
characters long 4
characters long
RESULT:
Thus all the test cases are successfully executed.
26
Ex.No:-12 Name:
Date - 10-02-2024 Reg. No. :
AIM:
To identify Test Cases for University result system.
Student Name
Student name should accept only character.
Register Number
Register number should accept only Number.
Date of Birth
Date of Birth should be in the format (MM/DD/YYYY).
Month should be with in this range 1 to 12.
Date should be within 1 to 31.
Department
Only one department can be selected from the dropdown list. Mark –
1
Mark should accept only number and should not exceed 100.
Mark – 2
Mark should accept only number and should not exceed 100.
Mark – 3
Mark should accept only number and should not exceed 100.
Mark – 4
Mark should accept only number and should not exceed 100.
Total
Total should display only numbers.
Total is the sum of Mark1, Mark2, Mark3 and Mark4 should not exceed 400.
Average
Average should display only numbers.
This should display the average of all the marks and should not exceed 100.
Result
Result should display either “Pass” or “Fail”
Grade
Grade should display any one out of the three classes based upon the average.
Average Grade
Above 85% Distinction
61% to 84% First Class
51% to 60% Second Class
40% to 50% Third Class
Test Case Report
S.NO Input Type of Expected Actual Output Result
Test Output
27
3 a) 03/30/1988 Valid Accepted Accepted Pass
b) 13/30/1988 Invalid Not Accepted Not Accepted Pass
FORM DESIGN:
28
Coding
Login Code
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
}
}
29
}
Mark Sheet
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
c = Int32.Parse(txttot.Text);
a = c / 4;
txtavg.Text = a.ToString();
if (a >= 85)
30
{
txtgrade.Text = "Distinction";
}
else if (a >= 60 && a < 85)
{
txtgrade.Text = "Ist Class";
}
else if (a >= 50 && a < 60)
{
txtgrade.Text = "IInd Class";
}
else if (a >= 40 && a < 50)
{
txtgrade.Text = "IIIrd Class";
}
else
{
txtgrade.Text = "IVth Class";
}
31
Result
Thus the above program has been executed and tested successfully.
32
Ex.No:-13 Name:
Date - 10-02-2024 Reg. No:
AIM:
Designation Only one designation can be selected from the dropdown list.
Qualification Only one qualification can be selected from the dropdown list.
Basic salary Basic salary should accept only numbers based upon the following constraints.
33
3 a) 03/30/1988 Valid Accepted Accepted Pass
b) 13/jun/1986 Invalid Not Accepted Not accepted Pass
Form Design
34
`
Coding
Login form
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
}
}
35
Employee from
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
}
36
else if (dropdest.Text == "Programmer")
{
if (bs >= 15000 && bs < 25000)
{
calc();
}
else
{
Label13.Text = "Basic Salary between 15000 to 25000"; }
}
}
protected void butcan_Click(object sender, EventArgs e)
{
clr();
}
Output
37
Result:
Thus the above program has been executed and tested successfully.
38
Ex.No:-14 Name:
Date - 13-02-2024 Reg. No :
OVERVIEW OF QTP
Aim:
What to test:
Testing tools can help automate tasks such as product installation, test data creation, GUI
interaction, problem detection, defect logging without necessary automating tests in an end-to-end
fashion.
One must keep satisfying popular requirements when thinking of test automation: •
Platform and OS independence
• Data driven capability(Input Data, Output Data, Meta Data)
• Easy debugging and logging
• Version control friendly – minimal binary files
• Extensible & customizable.
• Email notification. This may be the test runner that executes it.
• Support distributed execution environment
Quick test professional (QTP) is an automated graphical user interface (GUI) testing tool that
allows the automation of user actions on a web or client based computer application. Features of
QTP:
• Ease of use
• Simple interface
• Presents the test case as a business workflow to the tester
• Uses a real programming language with numerous resources available. • Quick test pro s
significantly easier for a non-technical person to adapt to and create working test cases,
compared to win runner
• Data table integration better and easier to use than win runner
• Test run iterations/Data driving a test is easier and better implement with quick test. •
Parameterization easier that win runner
40
Ex.No:-15 Name:
Date - 20-02-2024 Reg. No. :
Aim
What is Selenium ?
In simple words, Selenium is a Test Automation Tool developed by the company named “Thought
Works” from the year 2004.
Most of the projects automate their applications for Firefox, Chrome and Internet Explorer
browser types.
The below are the 5 browser types that Selenium supports in total:
Browsers supported by Selenium
Selenium supports all the famous operating system in the market. The below are the 3 operating
systems that
Selenium supports:
Operating Systems supported by Selenium
41
Intro- History of Selenium
Selenium Core
• Selenium was created by Jason Huggins in 2004. To avoid repeated execution of test cases
day by day,
• He created a javascript program and named it JavaScriptRunner which was later renamed as
Selenium core.
• Over a period of time, Applications were only allowing the internal JavaScript programs by
treating the external JavaScript programs as a security break. This became a drawback for
Selenium core as it uses JavaScript programs to interact with the Application under test. To
overcome this problem while testing using
• Selenium core application testers used to install the Selenium Core’s JavaScript programs
into the Application code’s local copy.
Selenium RC
• To overcome the drawback of Selenium core, Paul Hammant has created a proxy server
named ‘Selenium RC’
• To trick the Application under test that the JavaScript programs are in the same local
machine where the
• Application is residing, even though it is not. The drawback of the Selenium RC approach is,
we have to use a proxy server named ‘Selenium RC’ to communicate between the
Application code and Automation code.
Selenium Grid
Selenium Grid was developed by Patrick Lightbody, to reduce the time of Automation scripts
execution by running the scripts in parallel on different machines. i.e. Instead of executing all the
scripts on a single machine, to reduce the time of execution, all the scripts will be divided across
different machines and
executed simultaneously.
Selenium IDE
• Selenium IDE was developed by Shinya Kasatani, to record the tests like recording a video
and execute the recorded tests like playing a video. Hence Selenium IDE is a record and
playback tool.
• Selenium IDE is released into the market as a Firefox add-on/plugin/extension and can be
installed on the top of the default
• Firefox browser. Once installed, we can simply record the tests on firefox browser and
playback when required. SafariDriver and OperaDriver. The development of this drivers is
done by Selenium guys, even though the drivers are native to Browsers.
Apart from learning Core Java, its required to learn different Web Technologies for Selenium
The below are the different Web Technologies which are required for learning Selenium: HTML
CSS
Xpath
DOM
JavaScript
XML
42
We can also call these tools set as Selenium components. It's not mandatory to use all these
components to automate applications, instead we select them for automation based on our
Applications requirement.
43
Ex.No:-16 Name:
Date - 20-02-2024 Reg. No. :
Aim
To understand the working of if else with different range of values and test cases
Program
Test cases:
Test case no: 1
Test case name: Positive values within range
Input =2 Expected output Actual output Remarks
2 is even number 2 is even number
3 is odd number 3 is odd number success
4 is even number 4 is even number
5 is odd number 5 is odd number
6 is even number 6 is even number
Result:
44
Ex.No:-17 Name:
Date - 27-02-2024 Reg. No:
break;
Output:
Input Output
Enter Your choice: 1
Enter a, b Values: 3, 2 The sum of a & b is:5
Enter Your choice: 2
Enter a, b Values: 3, 2 The diff of a & b is: 1
Enter Your choice: 3
Enter a, b Values: 3, 2 The Mul of a & b is: 6
Enter Your choice: 4
Enter a, b Values: 3, 2 The Div of a & b is: 1
45
Ex.No:-18 Name:
Date - 27-02-2024 Reg. No :
Aim : To understand the working of switch with different range of values and test case
Program
#include <conio.h>
void main() {
int a,b,c;
clrscr();
printf(“1.Add/n 2.Sub /n 3.Mul /n 4.Div /n Enter Your
choice”); scanf(“%d”, &i);
printf(“Enter a,b values”);
scanf(“%d%d”,&a,&b);
switch(i) {
case 1: c=a+b;
printf(“ The sum of a & b is: %d” ,c); break;
case 2: c=a-b;
printf(“ The Diff of a & b is: %d” ,c); break;
case 3: c=a*b;
printf(“ The Mul of a & b is: %d” ,c); break;
case 4: c=a/b;
printf(“ The Div of a & b is: %d” ,c); break;
default:
printf(“ Enter your choice”);
break;
Result: Thus, the output was successfully verified
46
Ex.No:-19 Name:
Date - 05-03-2024 Reg. No. :
Aim: To understand the working of for with different range of values and test cases
Program
#include <stdio.h>
#include <conio.h>
void main (){
int i; clrscr();
printf(“enter a no”);
scanf(“%d”,&i);
for(i=1 ;i<=5;i++) {
if(i%2==0) {
printf(“%d”, i);
printf(“ is a even no”); i++;
}
printf(“%d”, i);
printf(“ is a odd no”); i++;
}
getch();
47
Ex.No:-20 Name:
Date - 12-03-2024 Reg. No. :
AIM-
PROGRAM
#include <stdio.h>
int search(int arr[], int N, int x)
{
int i;
for (i = 0; i < N; i++)
if (arr[i] == x)
return i;
return -1;
}
// Driver's code
int main(void)
{
int arr[] = { 2, 3, 4, 10, 40 };
int x = 10;
int N = sizeof(arr) / sizeof(arr[0]);
// Function call
int result = search(arr, N, x);
(result == -1)
? printf("Element is not present in array")
: printf("Element is present at index %d", result);
return 0;
}
OUTPUT
48