Testing Lab

Download as pdf or txt
Download as pdf or txt
You are on page 1of 32

Arba Minch University

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

Triangle Problem -Decision Table Test cases for input data

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
{

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)
printf("\nthe value of a=%d is not the range of permitted value",a);
if (!c2)

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

} while(!(c1 && c2 && c3));

// 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");

6
else
printf("Not a triangle\n");

return 0;
}

Test Case Name: Boundary Value Analysis for triangle problem


Experiment Number: 2
Test Data: Enter the 3 Integer Value ( a , b And c )
Pre-condition: 1 ≤ a ≤ 10, 1 ≤ b ≤ 10 and 1 ≤ c ≤ 10 and 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

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

// 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");

12
return 0;
}

Test Case Name : Equivalence class Analysis for triangle problem


Experiment Number : 3
Test Data : Enter the 3 Integer Value( a , b And c )
Pre-condition : 1 ≤ a ≤ 10 , 1 ≤ b ≤ 10 and 1 ≤ c ≤ 10 and 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

Triangle Problem -Equivalence Class Test cases for input data

13
14
15
Sample Output – Weak Equivalence Class Testing

16
Sample Output – Weak Robust

17
Sample Output – Strong Robust

Result

Thus the program was successfully executed by using C Language.

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

Test Case Name: Positive values within range

Result Succeed

20
Test Case Name: Negative values within range

Result Succeed

Result:
The above program is executed successfully.

21
Program 5

Aim: To demonstrate the working of switch constructs.


Objective: To understand the working of switch with different range of values and test cases.

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

1. Validity of the card.


2. Withdraw Transaction flow of ATM.
3. Authentication of the user’s.
4. Dispense the cash from the account.
5. Verify the balance enquiry.
6. Change of PIN number.

24
Bugs Identified:

Bug_ID Bug_Name
ATM_001 Invalid Card

ATM_002 Invalid PIN

ATM_003 Invalid Account type

ATM_004 Insufficient Balance

ATM_005 Transaction Limit

ATM_006 Day limit

ATM_007 Invalid money denominations

ATM_008 Receipt not printed

ATM_009 PIN change mismatch

Bug Report:

Bug Id: ATM_001


Bug Description: Invalid card
Steps to reproduce: 1. Keep valid card in the ATM.
Expected Result: Welcome Screen
Actual Result: Invalid card
Status : Pass/Fail

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

Bug Id: ATM_003


Bug Description: Invalid Account type selected.
Steps to reproduce:
1. Enter a valid user PIN number.
2. Select the withdraw option on the main menu.
3. Choose the correct type of account (either savings or current account).
Expected Result: Enter the Amount screen displayed
Actual Result: Invalid Account type screen is displayed.
Status : Pass/Fail

Bug Id: ATM_004


Bug Description: Insufficient Balance
Steps to reproduce:
1. Menu screen should be displayed.
2. Select the withdraw option.
3. Select the correct type of account.
4. Enter the sufficient amount to withdraw from the account.
5. Dispense the cash screen & amount to be deducted from account
Expected Result: Collect the amount screen displayed
Actual Result: Insufficient balance in the account. 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

Bug Id: ATM_006


Bug Description: Withdraw limit per day
Steps to reproduce:
1. Keep a valid card in ATM.
2. Enter the authorized PIN.
3. Enter the amount to withdraw from the account.
4. Amount enter is over the day limit (>40000)
5. Amount enter is over the day limit and display screen is displayed.
Expected Result: Cash is dispensed and collect the receipt.
Actual Result: Day 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

Bug Id: ATM_008


Bug Description: Statement not printed
Steps to reproduce:
1. Keep a valid card in ATM.
2. Enter the authorized PIN.
3. Select the mini statement.
4. Current balance is displayed on the screen.
5. Collect printed receipt of the statement.
Expected Result: Collect the mini statement receipt
Actual Result: receipt not printed.
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

You might also like