Вы находитесь на странице: 1из 7

Software Testing and Debugging Lab

(10B1WCI575)

Submitted By:
Aishwarya Saxena
Roll No: 121218
Batch: B1

Index
S. No.

Name

Date

Remarks

Aim:
To learn about equivalence class partitioning and boundary value analysis and make test
cases of certain programs.

Question 1:
Consider the program done in lab1 for comparing of two numbers and design the various test
cases using Equivalent classes (Strong & Week) and BVA techniques.

Boundary Value Analysis:


Test Case ID

Output

2147483647

a>b

2147483646

a>b

a=b

-2147483647

a<b

-2147483648

a<b

2147483647

a<b

2147483646

a<b

-2147483647

a<b

-2147483648

a<b

Weak Equivalence Class Partitioning:


Test case ID

Output

1.

2500

5560

Valid

2.

-2147483790

-2147499748

Invalid

3.

2147483999

2147483999

Invalid

Strong Equivalence Class Partitioning:


Test case ID
1.
2.
3.
4.
5.
6.
7.
8.
9.

a
0
0
0
-2147483790
-2147483790
-2147483790
2147483999
2147483999
2147483999

b
-2147483790
0
2147483999
-2147483790
0
2147483999
-2147483790
0
2147483999

Output
Invalid
Valid
Invalid
Invalid
Invalid
Invalid
Invalid
Invalid
Invalid

Question 2:
Consider the program done in lab1 in assignment section for problem 1 & 2 and design the
various test cases using Equivalent classes (Strong & Week) and BVA techniques.

Boundary Value Analysis:


Test Case ID
1.
2.
3.
4.
5.
6.
7.

a
2147483647
2147483646
0
-2147483647
-2147483648
0
0

b
0
0
0
0
0
2147483647
2147483646

Output
Print Even number
Print Even number
0
Print Even number
Print Even number
Print Even number
Print Even number

Weak Equivalence Class Partitioning:


Test Case ID
1.
2.
3.

a
2500
-2147483790
2147483999

b
5560
-2147499748
2147483999

Output
Print Even number
Invalid
Invalid

Strong Equivalence Class Partitioning:


Test Case ID
1.
2.
3.
4.
5.
6.
7.
8.
9.

a
0
20
0
-2147483790
-2147483790
-2147483790
2147483999
2147483999
2147483999

b
-2147483790
30
2147483999
-2147483790
0
2147483999
-2147483790
0
2147483999

Output
Invalid
Valid
Invalid
Invalid
Invalid
Invalid
Invalid
Invalid
Invalid

Question 4:
Consider a class that represents a ticket purchased for an event at a theatre.
a) Program:

import java.io.*;
class IllegalValueException extends Throwable{
/**
*
*/
private static final long serialVersionUID = 1L;
private double a;
IllegalValueException(double e){
a=e;
}
}
public class TheatreTicket{
private double price;
private int row;
private int seat;
public double getPrice(){
return price;

}
public void setPrice(double amount)throws IllegalValueException{
if(amount<=0)
throw new IllegalValueException(amount);
else{
price=amount;
System.out.println("Price of the ticket is: "+this.getPrice());
}
}
public void setLocation(int r, int s){
if(r>0 && r<=50 && s>0 && s<=100){
row=r;
seat=s;
}
else
System.out.println("Invalid Location");
}
public static void main(String[] args) throws IOException {
double amt;
int r,c;
TheatreTicket t=new TheatreTicket();
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the amount of ticket");
try{
amt=Double.parseDouble(br.readLine());
t.setPrice(amt);
}
catch(IllegalValueException e){
System.out.println("Illegal Value");
}
catch(IOException ie){
System.out.println("Illegal Value");
}

}
}

b) Equivalence classes for amount:


Test Case ID
Seat
1
0
2
1
3
50
4
50
1) Amount<0 : Invalid
2) Amount>=0: Valid

Row
25
25
0
49

Output
valid
valid
valid
valid

c) Boundary Value Analysis:

Equivalence Class Test Cases:


1)
2)
3)
4)
5)
6)

Seat<0
0<=seat<=100
Seat>100
Row<0
0<=row<=50
Row>50

Test Case ID
1
2
3
4

Seat
-20
45
110
50

Row
-3
25
50
67

Output
invalid
valid
invalid
invalid

Вам также может понравиться