0% found this document useful (0 votes)
5 views46 pages

ST - Lab Manual Copy

The document is a lab manual for the MCA II Semester at SRM Institute of Science and Technology, detailing various test cases for software testing programs. It includes a list of programs with their respective test cases, expected outputs, and actual results for tasks such as finding the largest number, generating Fibonacci series, checking for palindromes, and more. Each program is accompanied by a brief aim and a sample code implementation.

Uploaded by

hl5670204
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)
5 views46 pages

ST - Lab Manual Copy

The document is a lab manual for the MCA II Semester at SRM Institute of Science and Technology, detailing various test cases for software testing programs. It includes a list of programs with their respective test cases, expected outputs, and actual results for tasks such as finding the largest number, generating Fibonacci series, checking for palindromes, and more. Each program is accompanied by a brief aim and a sample code implementation.

Uploaded by

hl5670204
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/ 46

SRM Institute of Science and Technology

Ramapuram Campus
Faculty of Science & Humanities
Department of Computer Science and Applications
(MCA)

Lab Manual

PG Degree Programme
MCA – II Semester
Batch : 2024-2025
SOFTWARE TESTING (PCA20D06J)

Academic Year 2024-2025

Prepared By Approved By

Dr. D Kanchana Dr. J. Dhilipan


Dr.T.Papitha Christobel (HOD/MCA)
Mrs.M.Divya
List of Programs

S.No Name of the Program Page No

1. Test Cases for Largest Number Among Three Number 05

2. Test Cases Report for Fibonacci Series 06

3. Test Cases Report for Palindrome 07

4. Test Cases Report for Count the Total Number of 09


Characters, Digits and Special Character in The Given
String
5. Test Cases Report for Check Leap Year or Not 11

6. Test Cases for The Arithmetic Operations in Calculator 13

7. Test Cases for Triangle Program 16

8. Test Cases for Binary Search Program 18

9. Test Cases for Sorting Program 20

10. Login Form 22

11. Test Cases for Checking the Login Process of Flight 26


Application
12. University Result System 27

13. Employee Information System 34

14. Overview of QTP 39

15. Overview Of Selenium Test Tool 45

Extra Programs Beyond the Syllabus

16. To demonstrate the working of if else construct 44

17. To demonstrate the working of switch construct 45

18. To demonstrate the working of switch case construct 46

19. To demonstrate working of for construct 47

20. Program To Implement Iterative Linear Search 48


Ex.No:-1 Name:
Date - Reg. No. :

TEST CASES FOR LARGEST NUMBER AMONG THREE NUMBER

AIM: To derive the test cases for largest number among three number

programs. Test Case Report

Test Input Data Type Of Test Expected Actual Output Result


ID Output

1. 233,23,199 Valid 233 is largest 233 is largest Pass

2. 0,0,0 Valid 0 is largest 0 is largest Pass

3. 2,@,1 InValid Error Error Pass

4. -1,-3,-8 InValid -1 is the largest -1 is largest Pass

5. e,a,r InValid Error Error Pass

PROGRAM:

#include <stdio.h>
int main( )
{
double n1, n2, n3;
printf("Enter three different numbers: ");
scanf("%lf %lf %lf", &n1, &n2, &n3);

// if n1 is greater than both n2 and n3, n1 is the largest


if (n1 >= n2 && n1 >= n3)
printf("%.2f is the largest number.", n1);

// if n2 is greater than both n1 and n3, n2 is the largest


if (n2 >= n1 && n2 >= n3)
printf("%.2f is the largest number.", n2);

// if n3 is greater than both n1 and n2, n3 is the largest


if (n3 >= n1 && n3 >= n2)
printf("%.2f is the largest number.", n3);

return 0;
}

RESULT:

Program Executed and Testing done successfully.

5
Ex.No: 2 Name:
Date: Reg. No. :

TEST CASES REPORT FOR FIBONACCI SERIES

AIM:

To derive the test cases for the Fibonacci series program.

Test Case Report


Test Input Data Type Of Test Expected Actual Output Result
ID Output

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

2. -23 InValid Error Error Pass

3. 0 Valid 0 0 Pass

4. @ InValid Error Error Pass

5. 1 Valid 0,1 0,1 Pass

6. 34.5 Valid Error Error Pass

PROGRAM:

#include <stdio.h>
int main() {
int t1 = 0, t2 = 1, nextTerm = 0, n;
printf("Enter a positive number: ");
scanf("%d", &n);

// displays the first two terms which is always 0 and 1


printf("Fibonacci Series: %d, %d, ", t1, t2);
nextTerm = t1 + t2;

while (nextTerm <= n) {


printf("%d, ", nextTerm);
t1 = t2;
t2 = nextTerm;
nextTerm = t1 + t2;
}

return 0;
}

RESULT:

Program Executed and Testing done successfully.

6
Ex.No:-3 Name:
Date - Reg. No.:

TEST CASES REPORT FOR PALINDROME

AIM:

To derive the test cases for the palindrome program.

Test Case Report


Test Input Data Type Of Test Expected Actual Output Result
ID Output

1. WOW Valid It is It is Palindrome Pass


Palindrome string
string

2. EAT Valid It is not a It is not a Pass


Palindrome Palindrome string
string

3. $ InValid Error It is Palindrome Fail


string

4. LEVEL Valid It is It is Palindrome Pass


Palindrome string
string

5. 5s InValid It is not It is not a Pass


Palindrome Palindrome string
string

6. 121 Valid It is It is Palindrome Pass


Palindrome string
string

7. 1MALAYAM1 Valid It is It is Palindrome Pass


Palindrome string
string

8. !121! Valid It is It is Palindrome Pass


Palindrome string
string

9 !1MADAM1! Valid It is It is Palindrome Pass


Palindrome string
string

10 1MALAYAM21 Valid It is not a It is not a Pass


Palindrome Palindrome string
string

7
Program:

#include <stdio.h>
#include <string.h>

int main()
{
char str[100];
int i, len, flag;
flag = 0;

printf("\n Please Enter any String : ");


gets(str);

len = strlen(str);
6

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


{
if(str[i] != str[len - i - 1])
{
flag = 1;
break;
}
}
if(flag == 0)
{
printf("\n %s is a Palindrome String", str);
}
else
{
printf("\n %s is Not a Palindrome String", str); }

return 0;
}

RESULT:

Program Executed and Testing done successfully.

8
Ex.No:- 4 Name:
Date - Reg. No :

TEST CASES REPORT FOR COUNT THE TOTAL NUMBER OF


CHARACTERS,DIGITS AND SPECIAL CHARACTER IN THE GIVEN STRING

AIM:

To derive the test cases for counting the total number of character programs.

Test Case Report

Test Input Data Type ofTest Expected Output Actual Output Result
ID

1. PYTHON21@ Valid Number of Number of Alphabet: 6 Pass


Alphabet: 6 Number of Digit : 2
Number of Digit : Number of Symbols:1
2 Number of
Symbols:1

2. 2323 Valid Number of Number of Alphabet: 0 Pass


Alphabet: 0 Number of Digit : 4
Number of Digit Number of Symbols:0
: 4 Number of
Symbols:0

3. English Valid Number of Number of Alphabet: 7 Pass


Alphabet: 7 Number of Digit : 0
Number of Digit : Number of Symbols:0
0 Number of
Symbols:0

4. $$$$@ Valid Number of Number of Alphabet: 0 Pass


Alphabet: 0 Number of Digit : 0
Number of Digit : Number of Symbols:5
0 Number of
Symbols:5

5. Graphics2302$ Valid Number of Number of Alphabet: 8 Pass


Alphabet: 8 Number of Digit : 4
Number of Digit : Number of Symbols:1
4 Number of
Symbols:1

9
Program:

import java.util.Scanner;

public class CountAlpDigiSpl1 {


private static Scanner sc;
public static void main(String[] args) {
String aldisp_str;
int i, alph, digi, spl;
alph = digi = spl = 0;
char ch;

sc= new Scanner(System.in);


System.out.print("\nPlease Enter Alpha Numeric Special String = ");
aldisp_str = sc.nextLine();

for(i = 0; i < aldisp_str.length(); i++)


{
ch = aldisp_str.charAt(i);

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 - Reg. No:

TEST CASES REPORT FOR CHECK LEAP YEAR OR NOT

AIM: To derive test cases for check leap year or not programs.

Test Case Report


Test Input Data Type Of Expected Output Actual Output Result
ID Test

1. 2004 Valid It is a leap year. It is a leap year. Pass

2. 1900 Valid It is a leap year. . It is a leap year. Pass

3. 2011 Valid It is not a leap year. It is not a leap year. Pass

4. 4004 Valid It is not a leap year. It is not a leap year. Pass

5. 24 Valid It is not a leap year. It is not a leap year. Pass

6. 0 InValid Error Error Pass

7. $21 InValid Error Error Pass

8. abc InValid Error Error Pass

PROGRAM:

#include <stdio.h>
int main() {
int year;
printf("Enter a year: ");
scanf("%d", &year);

// leap year if perfectly divisible by 400


if (year % 400 == 0) {
printf("%d is a leap year.", year);
}
// not a leap year if divisible by 100
// but not divisible by 400
else if (year % 100 == 0) {
printf("%d is not a leap year.", year);
}
// leap year if not divisible by 100
11
// but divisible by 4
else if (year % 4 == 0) {
printf("%d is a leap year.", year);
}
// all other years are not leap years
else {
printf("%d is not a leap year.", year);
}

return 0;
}

RESULT: Thus the test case for checking leap year or not programs is successfully executed.

12
Ex.No:-6 Name:
Date - Reg. No. :

TEST CASES FOR THE ARITHEMATIC OPERATIONS IN CALCULATOR

AIM: To derive test cases for the arithematic operation in calculator.

Test case report


Test ID ACTION EXPECTED RESULT ACTUAL RESULT PASS/FAIL

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

4. Click the “=” symbol The difference of The difference of PASS


the numbers should the numbers should
be be
displayed(5-4=9) displayed(5-4=9)

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: Thus all the test cases are successfully executed.

14
Ex.No:-7 Name:
Date - Reg. No:

TEST CASESS FOR TRIANGLE PROGRAM

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.

Test case specifications:

1. A test case that represent valid scalene triangle.

2. A test case to represent a valid equilateral triangle.

3. A test case that represents a valid isosceles triangle.

4. A test case with three integers greater than zero such that sum of two integers should be
less than the third integer.

5. A test case in which one side has a zero value.

6. A test case in which one side has a negative value.

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.

9. A test case with all sides zero.

10. A test case with non-integer values.

11. A test case that specifies wrong number of values (3,2)

Test Case Report

Test Input Data Type Expected Output Actual Output Result


ID Of
Test

1. (3,4,5) Valid Scalene Triangle Scalene Triangle Pass

2. (3,3,3) Valid Equilateral Triangle Equilateral Triangle Pass

3. (5,5,8) Valid Isosceles Triangle Isosceles Triangle Pass

4. (2,1,4) Invalid Invalid Triangle Invalid Triangle Pass

15
5. (0,1,9) Invalid Invalid Triangle Invalid Triangle Pass

6. (5,5,-5) Invalid Invalid Triangle Invalid Triangle Pass

7. (1,2,3) Invalid Invalid Triangle Invalid Triangle Pass

8(a) (2,3,5) Invalid Invalid Triangle Invalid Triangle Pass

(b) (3,2,5) Invalid Invalid Triangle Invalid Triangle Pass

(c) (5,2,3) Invalid Invalid Triangle Invalid Triangle Pass

9. (0,0,0) Invalid Invalid Triangle Invalid Triangle Pass

10. (3.2,4.5,3.8) Valid Scalene Triangle Scalene Triangle Pass

11. (3,2) Invalid Invalid Triangle Invalid Triangle Pass

12 (5,a,@) Invalid Invalid Triangle Invalid Triangle Pass

13 (1,2,3,6) 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)) {

if(a>0 && b>0 && c>0) {


if((a==b || b==c || c==a) && (a!=b || b!=c || c!=a))
{
printf("Isosceles Triangle\n");
}
else if( (a!=b) && (b!=c) && (c!=a))
{
printf("Scalene Triangle\n");
}
else if((a==b) && (b==c) && (c==a)) {
printf("Equilateral Triangle\n");

}}
}
else
{

16
15
printf("invalid triangle");
}

getch();
}

RESULT: Thus the test cases for triangle program are successfully executed.

17
Ex.No:-8 Name:
Date - Reg. No. :

TEST CASES FOR BINARY SEARCH PROGRAM

AIM:

To derive test cases for Binary search Program .

Test Case Specifications:

1. A Test case that contain one element.


2. A Test case that contain Empty list.
3. A Test case with same numbers as input.
4. A Test case with negative input value.
5. A Test case with odd number of inputs.
6. A Test case with even number of inputs.
7. A Test case to search the number which is not in the given list.
8. A Test case that contains alphabets.
9. A Test case with non-integer values as input.

Test Case Report


Test Input Data Type Of Expected Output Actual Output Result
ID Test

1 7(search 7) Valid Found at 0th position Found at 0th position Pass

2 Empty Invalid Error Error Pass

nd
3 5,5,5,5,5(search 5) Valid Found at 2nd position Found at 2 position Pass

4 2,-8,5,7,8(search Valid Found at 1st position Found at 1st position Pass


- 8)

5. 3,5,7 (search 5)_ Valid Found at First Found at First Pass


Position Position
th
6 2,4,6,8(search 2) Valid Found at 0th position Found at 0 position Pass

7. 2,7,9,11 (search 5) Invalid Error Error Pass

8. 1,2,3,a,b(Search 3) Invalid Error Error Pass

1,2,2.3,4.5,6.5(Se nd nd
9. Valid Found at 2 position Found at 2 position Pass
ar ch 4.5)

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 : Program Executed and Testing done successfully.

19
Ex.No:-9 Name:
Date - Reg. No. :

TEST CASES FOR SORTING PROGRAM

AIM:

To derive test cases for sorting programs.

Test Case Specifications:

1. A Test case to sort already sorted list


2. A Test case to sort the input list with all zeros
3. A Test case to sort with same numbers
4. A Test case to sort to represent a valid input list.
5. A Test case to sort to represent invalid input list.
6. A Test case to sort a non-integer list of input.
7. A Test case to sort the input list with a negative list.
8. A Test case to sort the input list value with only one value.
9. A Test case to sort the input list with integers, negative integers and non-integer values.
10. A Test case to sort the input list with only two values.

Test Case Report


Test ID Input Data Type Of Test Expected Actual Result
Output Output

1 (1,2,3,4,5) Valid (1,2,3,4,5) (1,2,3,4,5) Pass

2. (0,0,0,0,0) Valid (0,0,0,0,0) (0,0,0,0,0) Pass

3. (6,6,6,6,6) Valid (6,6,6,6,6) (6,6,6,6,6) Pass

4. (1,2,3,0,7) Valid (1,2,3,0,7) (1,2,3,0,7) Pass

5 (a,1,c,d,2,3) Invalid Error Error Pass

6. (4,-3,-4,0,7) Valid (-)4,(-)3,0,4,7 (-)4,(-)3,0,4,7 Pass

7. 5 Valid 5 5 Pass

8. -5,-2,-7,-3,-1 Valid -1,0.5,1.2,2.5 -1,0.5,1,2.5 Pass

9. 50,19 Valid 19,50 19,50 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 - Reg. No. :
LOGIN FORM

AIM
To identify Test case for Login Form

Test Case Specifications

User_name
User_name should accept alphanumeric.
Password
Password should accept alphanumeric.

Test Case Report


S.NO Input Type of Test Expected Output Actual Output Result

1 a) Admin Valid Accepted Accepted Pass


b) 3434 Valid Accepted Accepted Pass
c) Admin123 Valid Accepted Accepted Pass

2 a) Sunrise_12 Valid Accepted Accepted Pass


b) 34 A200 Valid Accepted Accepted Pass
c) Raja Valid Accepted Accepted Pass

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;

public partial class Default2 : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{
Label3.Text = "";
}
protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text == "Admin" && TextBox2.Text == "admin" )
{
Response.Redirect ("default.aspx");
}
else
{
Label3.Text = "Invalid username and password...";
}

}
}

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;

public partial class _Default : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = " Thank U....";
}
}

OUTPUT:

RESULT: Thus all the test cases are successfully executed.

24
Ex.No:-11 Name:
Date - Reg. No:

TEST CASES FOR CHECKING THE LOGIN PROCESS OF FLIGHT


APPLICATION

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

STE ACTION EXPECTED ACTUAL RESULT PASS/FAIL


P RESULT
NO:

1. Enter the Username : Incorrect Incorrect PASS


abcd Enter Password : password. Please password. Please
abcd try again try again

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

3. Enter the Username : Please enter Please enter PASS


Enter Password : mercury agent name agent name

4. Enter the Username : Please enter Please enter PASS


abcd Enter Password : Password Password

5. Enter the Username : Login Login PASS


1234 Enter Password :
mercury

6. Enter the Username : Login Login PASS


!@#$% Enter Password :
mercury

25
STEP ACTION EXPECTED ACTUAL PASS/FAIL
NO: RESULT RESULT

7. Enter the Username : Incorrect Incorrect PASS


abcd Enter Password: password. Please password. Please
mercury! try again try again

8. Enter the Username : Login Login PASS


Abcd Enter Password :
mercury

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 - Reg. No. :

University Result System

AIM:
To identify Test Cases for University result system.

Test Case Specification:

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

1 a) Dharmaraj Valid Accepted Accepted Pass


b) Arun123 Invalid Not Accepted Not Accepted Pass

2 a) 1001 Valid Accepted Accepted Pass


b) A200 Invalid Not Accepted Not Accepted Pass

27
3 a) 03/30/1988 Valid Accepted Accepted Pass
b) 13/30/1988 Invalid Not Accepted Not Accepted Pass

4 a) 80 Valid Accepted Accepted Pass


b) 101 Invalid Not Accepted Not Accepted Pass

5 a) 79 Valid Accepted Accepted Pass


b) 13a Invalid Not Accepted Not Accepted Pass

6 a) 99 Valid Accepted Accepted Pass


b) 1000 Invalid Not Accepted Not Accepted Pass

7 a) 85 Valid Accepted Accepted Pass


b) -12 Invalid Not Accepted Not Accepted Pass

8 a) 400 Valid Accepted Accepted Pass


b) 401 Invalid Not Accepted Not Accepted Pass

9 a) 99% Valid Accepted Accepted Pass


b) 101% Invalid Not Accepted Not Accepted Pass

10 a) M1=40,M2=99,M3=41,M4=10 Valid PASS PASS Pass


b) 0 Valid FAIL FAIL Pass
M1=39,M2=40,M3=41,M4=56

11 a) Avg=86 Valid Distinction Distinction Pass


b) Avg=60 Valid First Class First Class Pass
c) Avg=55 Valid Second Class Second Class Pass
d) Avg=45 Valid Third Class Third Class 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;

public partial class Default2 : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{
Label3.Text = "";
}
protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text == "Admin" && TextBox2.Text == "admin" )
{
Response.Redirect ("default.aspx");
}
else
{
Label3.Text = "Invalid username and password...";
}
}
}
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;

public partial class _Default : System.Web.UI.Page {


protected void clr()
{
txtname.Text = "";
txtreg.Text = "";
txtdob.Text = "";
txtsub1.Text = "";
txtsub2.Text = "";
txtsub3.Text = "";
txtsub4.Text = "";
txttot.Text = "";
txtavg.Text = "";
txtres.Text = "";
txtgrade.Text = "";
DropDownList2.Text = "-- Select --";
Label12.Text = "";
}
protected void butsub_Click(object sender, EventArgs e) {
int s1, s2, s3, s4, c;
float a;
s1 = Int32.Parse(txtsub1.Text);
s2 = Int32.Parse(txtsub2.Text);
s3 = Int32.Parse(txtsub3.Text);
s4 = Int32.Parse(txtsub4.Text);
if (s1 < 40 || s2 < 40 || s3 < 40 || s4 < 40)
{
txtres.Text = "Pass";
}
else
{
txtres.Text = "Pass";
}
c = s1 + s2 + s3 + s4;
txttot.Text = c.ToString();

c = Int32.Parse(txttot.Text);
a = c / 4;
txtavg.Text = a.ToString();

if (a >= 85)
{
txtgrade.Text = "Distinction";
}
30
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";
}

OleDbConnection con=new OleDbConnection ("Provider=Microsoft.Jet.OLEDB.4.0;Data


Source='C://Documents and Settings//DHARMA//My Documents//Visual Studio
2005//WebSites//marksheet//mark.mdb'");
con.Open();
OleDbCommand cmd=new OleDbCommand("insert into sheet values('"+txtname.Text
+"','"+txtreg.Text+"','"+txtdob.Text+"','"+ DropDownList2.Text
+"','"+txtsub1.Text+"','"+txtsub2.Text +"','"+txtsub3.Text +"','"+txtsub4.Text+"','"+txttot.Text
+"','"+txtavg.Text +"','"+txtres.Text +"','"+txtgrade.Text +"')",con);
cmd.ExecuteNonQuery();
con.Close();
Label12.Text = "Record Saved....";
}

protected void butcan_Click(object sender, EventArgs e)


{
clrscr();
}
}
Output:

31
Result: Thus the above program has been executed and tested successfully.

32
Ex.No:-13 Name:
Date - Reg. No:

EMPLOYEE INFORMATION SYSTEM

AIM:

To identify test cases for the Employee Information System.

Test Case Specifications:

Employee Name Employee names should accept only characters.

Employee ID Employee ID should accept only Number.

Date of Birth Date of Birth should be in the format (MM/DD/YYYY).

Months should be within this range 1 to 12.

Date should be within 1 to 31.

Age: Age should be accepting only Number.

Age should not exceed 100.

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.

1. Programmer - within this range 15000 to 25000.

2. Team Leader - within this range 26000 to 35000.

3. Project Manager - within this range 36000 to 45000.

33
Test Case Report
S. No. Input Type of Test Expected Output Actual Output Result

1 a) Dharma raj Valid Accepted Accepted Pass

b) Arun123 Invalid Not Accepted Not Accepted Pass

2 a) 1001 Valid Accepted Accepted Pass

b) A200 Invalid Not Accepted Not accepted Pass

3 a) 03/30/1988 Valid Accepted Accepted Pass


b) 13/jun/1986 Invalid Not Accepted Not accepted Pass

4 a) 21 Valid Accepted Accepted Pass

b) 102 Invalid Not Accepted Not accepted Pass

5 a) Select a Valid Accepted Accepted Pass


Designation
from the list
b) Invalid Not Accepted Not Accepted Pass
Nothing is selected

6 a) Select a Valid Accepted Accepted Pass


qualification
from the list
b) Invalid Not Accepted Not Accepted Pass
Nothing is selected

7 a) 35000 Valid Accepted Accepted Pass

b) 50000 Invalid Not Accepted Not Accepted Pass

34
Form Design

`
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;
35
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Default2 : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e) {
Label3.Text = "";
}
protected void Button1_Click(object sender, EventArgs e) {
if (TextBox1.Text == "Admin" && TextBox2.Text == "admin" ) {
Response.Redirect ("default.aspx");
}
else
{
Label3.Text = "Invalid username and password..."; }

}
}

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;

public partial class _Default : System.Web.UI.Page


{
float bs;

protected void Page_Load(object sender, EventArgs e) {


Label13.Text = "";
}
protected void clr()
{
txtname.Text = "";
txtid.Text = "";
txtage.Text = "";
txtdob.Text = "";
dropdest.Text = "-- Select --";
dropqual.Text = "-- Select --";
txtbs.Text = "";
Label12.Text = "";
Label13.Text = "";
}

protected void butsub_Click(object sender, EventArgs e) {


bs = float.Parse(txtbs.Text);
if (dropdest.Text == "Project Manager")
36
{
if (bs >= 35000 && bs <= 45000)
{
calc();
}
else
{
Label13.Text = "Basic Salary between 35000 to 45000"; }
}
else if (dropdest.Text == "Team Leader")
{
if (bs >= 25000 && bs < 35000)
{
calc();
}
else
{
Label13.Text = "Basic Salary between 25000 to 35000"; }

}
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();
}

protected void calc()


{
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source='C://Documents and Settings//DHARMA//My Documents//Visual Studio
2005//WebSites//Employee//mark.mdb'");
con.Open();
OleDbCommand cmd = new OleDbCommand("insert into emp values('" + txtname.Text + "','"
+ txtid.Text + "','" + txtdob.Text + "','" + txtage.Text + "','" + dropdest.Text + "','" +
dropqual.Text + "','" + txtbs.Text + "')", con);
cmd.ExecuteNonQuery();
con.Close();

Label12.Text = "Record Saved....";


}

protected void butcan_Click1(object sender, EventArgs e)


{
clr();
}
}

37
Output

Result: Thus the above program has been executed and tested successfully.

38
Ex.No:-14 Name:
Date - Reg. No :
OVERVIEW OF QTP
Aim:

Introduction to Automated testing tools


Test automation is the use of software to control the execution of tests, the comparison
of actual to predicted outcomes, the setting up of test preconditions, and other test control and test
reporting functions. Commonly, test automation involves automating a manual process already in
place that uses a formalized testing process.

Manual testing versus automated testing


• The effort required to produce written test cases for manual execution •
The effort required to produces test cases for test automation
• The probably number of times those test cases are executed for this test cycle •
The likelihood of reusing automated test cases for future test cycles

There are two general approaches to test automation:


• Code-driven testing: The public interfaces to classes, modules, or libraries are tested with
a variety of input arguments to validate that the results that are returned are correct.
• Graphical user interface testing: A testing framework generates user interface events
such as keystrokes and mouse clicks, and observes the changes that result in the user
interface, to validate that the observable behavior of the program is correct.

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

Framework approach in automation:


A framework is an integrated system that sets the rules of automation of a specific
product. This system integrates the function libraries, test data sources, object details and various
reusable modules.
Various types of frameworks:
1. Data-driven testing
2. Modularity-driven testing
3. Keyword-driven testing
4. Hybrid testing
5. Model-based testing
Popular test automation tools
1. Selenium
2. TestComplete
3. QMetry Automation Studio
39
4. HP QTP/UFT
5. Testim.io
6. HP Quality Center (HP ALM)
7. TestComplete
8. Test Studio
9. Katalon Studio
10. IBM Rational Functional Tester
11. Ranorex
12. Appium
13. Robotium
14. Cucumber
15. EggPlant
16. SilkTest
17. Watir
18. Sauce labs
19. Sahi Pro
20. Sikuli
21. IBM Performance Tester
22. Apache JMeter
23. BlazeMeter
24. HP LoadRunner
Quick test professional

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

The features and benefits of Quick Test Pro (QTP):


1. Keyword driven testing
2. Suitable for both client server and web based application
3. VB script as the script language
4. Better error handling mechanism
5. Excellent data driven testing features.

40
Ex.No:-15 Name:
Date - Reg. No. :

OVERVIEW OF SELENIUM TEST TOOL

Aim

What is Selenium ?
In simple words, Selenium is a Test Automation Tool developed by the company named
“Thought Works” from the year 2004.

Things that Selenium can automate


Selenium can automate Web Applications which generally run in Web Browsers. For example,
Selenium can automate web applications like www.gmail.com, as it runs over web browsers.
Things that Selenium cannot automate
Selenium cannot automate Desktop / Windows based applications which don‟t run on Web
Browsers .
For example,
• Selenium cannot automate desktop / windows based applications like MS Word, MS Excel
etc.
• Luckily most of the applications in the market are Web Applications. •
Selenium is an Open Source and Free tool
• Unlike other proprietary tools which require us to purchase a license for using them,
Selenium is an open source and free tool. We don‟t have to spend a single penny for using
Selenium tool

Introduction Different components in Selenium


Selenium is not a single tool, instead it is a set of tools. The below are the four different
components which we
together call as Selenium:

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

Intro- Programming languages supported by Selenium


Selenium supports multiple programming languages for creating automation scripts. Hence we
can use any of the below programming languages supported by Selenium: So far, Selenium was
released into the market in 3 different versions. The below are the three different version
of Selenium:
Selenium 1 .
Selenium 2 ...
Selenium 3
Different versions of Selenium
Out of all the languages supported, Selenium has more support for Java language and most of the
Projects useJava, C#, Ruby and Python for automation the scripts using Selenium. And also, we
can automate the scripts in Selenium using Java language, even though the application under test
is developed using C# languages. The latest version of Selenium is Selenium 3 and it got released
into the market on Oct 13, 2016.

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
Selenium Tools Set
Selenium is not a single tool, instead it is a set of tools. The below are the four different tools
which we
together call as Selenium:
Selenium IDE
Selenium RC
Selenium WebDriver
Selenium Grid

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 - Reg. No. :

DEMONSTRATE THE WORKING OF IF ELSE CONSTRUCT

Aim
To understand the working of if else with different range of values and test cases

Program

#include <conio.h> void main()


{
int i;
for(i=1 ;i<=5;i++)
{
if( i%2==0)
{
printf("number is even no:%d\n",i); i++;
}
printf("number is odd no:%d\n",i);
}
getch();
}
Input Actual output
i=1
number is odd no:1
number is even no:2
number is odd no:3
number is even no:4
number is odd no:5

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: Thus, the output was successfully verified

44
Ex.No:-17 Name:
Date - Reg. No:

DEMONSTRATE THE WORKING OF SWITCH CONSTRUCT

Aim To understand the working of switch with different range of values and test
cases
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;

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

Result: Thus, the output was successfully verified

45
Ex.No:-18 Name:
Date - Reg. No :

DEMONSTRATE THE WORKING OF SWITCH CONSTRUCT

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 - Reg. No. :

DEMONSTRATE WORKING OF FOR CONSTRUCT

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();

Output: Enter no:5


0 is a even no
1 is a odd no
2 is a even no
3 is a odd no
4 is a even no

Result: Thus, the output was successfully verified

47
Ex.No:-20 Name:
Date - Reg. No. :

PROGRAM TO IMPLEMENT ITERATIVE LINEAR SEARCH

AIM-

To implement iterative linear search

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

Element is present at index 3

Result: Thus, the output was successfully verified

48

You might also like