Testing Lab
Testing Lab
Testing Lab
Institute of Technology
Faculty of Computing & Software Engineering
Software Testing Lab Manual
Target Group : G3 Sec A & B
Prepared by : Dr. Azath Hussain (PhD)
Lab Exercise # 1
Program 1: Decision table approach for solving triangle problem
/* Design and develop a program in a language of your choice to solve the triangle problem defined as follows : Accept three integers which are
supposed to be the three sides of triangle and determine if the three values represent an equilateral triangle, isosceles triangle, scalene triangle, or
they do not form a triangle at all. Derive test cases for your program based on decision-table approach, execute the test cases and discuss the
results */
#include<stdio.h>
int main()
{
int a,b,c;
char istriangle;
printf("enter 3 integers which are sides of triangle\n");
scanf("%d%d%d",&a,&b,&c);
printf("a=%d\t,b=%d\t,c=%d",a,b,c);
1
// to check is it a triangle or not
if( a<b+c && b<a+c && c<a+b )
istriangle='y';
else
istriangle ='n';
;
if (istriangle=='y')
if ((a==b) && (b==c))
printf("equilateral triangle\n");
else if ((a!=b) && (a!=c) && (b!=c))
printf("scalene triangle\n");
else
printf("isosceles triangle\n");
else
printf("Not a triangle\n");
return 0;
}
Test Case Name: Decision table for triangle problem
Experiment Number: 1
Test Data: Enter the 3 Integer Value ( a , b And c )
Pre-condition: a < b + c , b < a + c and c < a + b
Brief Description: Check whether given value for a equilateral, isosceles, Scalene triangle or can't from a triangle
2
Input Data Decision Table
3
Sample Output
Result:
The above program was compiled and executed successfully.
4
Lab Exercise # 2
Program 2 (Boundary value analysis program)
/* Design and develop a program in a language of your choice to solve the triangle problem defined as follows : Accept three integers which
are supposed to be the three sides of triangle and determine if the three values represent an equilateral triangle, isosceles triangle, scalene
triangle, or they do not form a triangle at all. Derive test cases for your program based on boundary value analysis, execute the test cases and
discuss the results */
#include<stdio.h>
int main()
{
int a,b,c,c1,c2,c3;
char istriangle;
do
{
5
printf("\nthe value of b=%d is not the range of permitted value",b);
if (!c3)
printf("\nthe value of c=%d is not the range of permitted value",c);
if (istriangle=='y')
if ((a==b) && (b==c))
printf("equilateral triangle\n");
else
printf("isosceles triangle\n");
6
else
printf("Not a triangle\n");
return 0;
}
7
Triangle Problem -Boundary value Test cases for input data
8
9
Sample Output
Result:
The above program was compiled and executed successfully.
10
Program 3 (Equivalence class partitioning program)
/* Design and develop a program in a language of your choice to solve the triangle problem defined as follows : Accept three integers which
are supposed to be the three sides of triangle and determine if the three values represent an equilateral triangle, isosceles triangle, scalene
triangle, or they do not form a triangle at all. Derive test cases for your program based on equivalence class partitioning, execute the test cases
and discuss the results */
#include<stdio.h>
int main()
{
int a,b,c , c1,c2,c3;
char istriangle;
do
{
printf("\nenter 3 integers which are sides of triangle\n");
scanf("%d%d%d",&a,&b,&c);
printf("\na=%d\tb=%d\tc=%d",a,b,c);
c1 = a>=1 && a<=10;
c2= b>=1 && b<=10;
c3= c>=1 && c<=10;
if (!c1)
11
printf("\nthe value of a=%d is not the range of permitted value",a);
if (!c2)
printf("\nthe value of b=%d is not the range of permitted value",b);
if (!c3)
printf("\nthe value of c=%d is not the range of permitted value",c);
} while(!(c1 && c2 && c3));
12
return 0;
}
13
14
15
Sample Output – Weak Equivalence Class Testing
16
Sample Output – Weak Robust
17
Sample Output – Strong Robust
Result
18
Program 4
Write a c program to demonstrate the working of the fallowing constructs: i) do…while
AIM: To demonstrate the working of do...while construct Objective
To understand the working of do while with different range of values and test cases.
#include <stdio.h>
void main ()
{
int i, n=5,j=0;
clrscr();
printf("enter a no");
scanf("%d",&i);
do
{
if(i%2==0)
{
printf("%d", i);
printf("is a even no.");
i++;
j++;
}
19
else
{
printf("%d", i);
printf("is a odd no.\n");
i++;
j++;
}
}
while(i>0&&j<n);
getch();
}
Sample Output
Result Succeed
20
Test Case Name: Negative values within range
Result Succeed
Result:
The above program is executed successfully.
21
Program 5
#include <stdio.h>
void main()
{
int a,b,c,i;
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;
22
default: printf("Enter your choice");
break;
}
getch();
}
Test Case 1
Result: Succeed
Result:
The above program was executed successfully.
23
Program 6
AIM: Take any system (e.g. ATM system) and study its system specifications and report the various
bugs.
Program:
Features to be tested:
24
Bugs Identified:
Bug_ID Bug_Name
ATM_001 Invalid Card
Bug Report:
25
Bug Id: ATM_002
Bug Description: Invalid PIN entered
Steps to reproduce:
1. Keep a valid card in ATM.
2. Enter the authorized PIN.
3. Menu screen should be displayed.
Expected Result: Menu screen displayed
Actual Result: Invalid PIN screen is displayed
Status : Pass/Fail
26
Bug Id: ATM_005
Bug Description: Withdraw Limit per transaction.
Steps to reproduce:
1. Menu screen should be displayed.
2. Select the withdraw option.
3. Select the correct type of account.
4. Enter sufficient amount to withdraw from the account Transaction within the limit.
5. Dispense the cash screen & amount to be deducted from account.
Expected Result: Cash is dispensed and collect the receipt
Actual Result: Transaction limit exceeded screen is displayed
Status : Pass/Fail
27
Bug Id: ATM_007
Bug Description: Amount enter denominations
Steps to reproduce:
1. Keep a valid card in ATM.
2. Enter the authorized PIN.
3. Enter the amount which should be in multiples of 100.
4. Cash Dispenser screen is displayed.
Expected Result: Collect the amount screen is displayed.
Actual Result: Amount enter not in required denominations.
Status : Pass/Fail
28
Bug Id: ATM_009
Bug Description: PIN mismatch
Steps to reproduce:
1. Keep a valid card in ATM.
2. Enter the authorized PIN.
3. Select the change PIN option on the menu.
4. Enter the current PIN.
5. Enter the new PIN.
6. Retype the new PIN
7. PIN successfully changed displayed on the screen.
Expected Result: PIN change successful.
Actual Result: PIN mismatched due to wrong PIN entered
Status : Pass/Fail
29
Application Test Test Scenario Test Case Expected Actual Status Test Data
Name Case Result Result
ID
CBE Online 1 Validate the Enter invalid System should not Customer Pass Ex:
Banking login page user name allow the customer is not able UserID : abcdef
Application enter invalid/ and valid to login the CBE to login Pwd : yz12
wrong user password in online Banking CBE
name and CBE online login page and it online
valid Banking should display the banking
password login page message like account
”please enter valid
user name and
password”
CBE Online 2 validate the Enter invalid System should not Customer Pass Ex:
Banking login page user name allow the customer is not able UserID : abcd
Application enter invalid and invalid to login the CBE to login Pwd : yz13
user name and pass word in online Banking CBE
invalid CBE online login page and it online
password Banking should display the Banking
login page message like “ account
please enter valid
user name and
password
30
CBE Online 3 Validate the Enter valid System should Customer Pass Ex:
Banking login page user name allow the user to is logged UserID : abcdef
Application enter valid and invalid login the CBE in to CBE Pwd : yz134
user name password in online Banking online
and invalid CBE online login page Banking
password Banking login page
login page
CBE Online 4 Validate the Enter valid System should Customer Pass Ex:
Banking login page user name allow the user to is logged
Application enter valid and valid login the CBE into CBE UID:a
user name password in online Banking online bcdefg
and valid CBE online login page Banking
PWD:x
password Banking login page
yz
login page
123
31
CBE Online 5 Validate the a) User a) User/customer Customer Fail
Banking user should able CBE login page with is not able
to login CBE valid.
Application information to see
login page
or detail in b) Customer should phone or
the b) User should be able to click mobile
Profile Page able to click on profile link. number
profile link
c) On c) Customer should
clicking see all the customer
profile link information once he
uses should clicking on profile
able to see hyper link
all user
details like
1)
Users/Custome
r Name
2)
User/Custo
mer Address
3)
User/Custo
mer Phone
number
Result:
The above test cases are tested effectively.
32