0% found this document useful (0 votes)
41 views

Branch, Decision Coverage

The document describes a Java program that takes in marks obtained in 5 subjects, calculates the sum and average, and prints the grade (A, B, C or D) based on the average. It then provides 3 test cases with sample input and output to test different parts of the program: 1) Statement coverage - Tests basic functionality with average over 80, 60-80, 40-60. 2) Decision coverage - Tests all decision points with 5 test cases covering various averages. 3) Boundary interior coverage - Shows control flow paths tested to ensure all conditions are tested.

Uploaded by

dsweetalker
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Branch, Decision Coverage

The document describes a Java program that takes in marks obtained in 5 subjects, calculates the sum and average, and prints the grade (A, B, C or D) based on the average. It then provides 3 test cases with sample input and output to test different parts of the program: 1) Statement coverage - Tests basic functionality with average over 80, 60-80, 40-60. 2) Decision coverage - Tests all decision points with 5 test cases covering various averages. 3) Boundary interior coverage - Shows control flow paths tested to ensure all conditions are tested.

Uploaded by

dsweetalker
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

1.

STATEMENT COVERAGE

10.
11.
12.
13.
14.
15.
16.
17.
18.

19. }

1.
2.
3.
4.
5.
6.
7.
8.
9.

int mark[] = new int[5];


int i;
float sum=0, avg;
Scanner scan = new Scanner(System.in);
System.out.print("Enter Marks Obtained
for(i=0; i<5; i++){
mark[i] = scan.nextInt();
sum = sum + mark[i];}
avg = sum/5;
System.out.print("Your Grade is ");
if(avg>80)
{ System.out.print("A"); }
else if(avg>60 && avg<=80)
{ System.out.print("B"); }
else if(avg>40 && avg<=60)
{ System.out.print("C"); }
else
{ System.out.print("D"); }

25

TC #1
MARK 1: 80
MARK 2: 80
MARK 3: 90
MARK 4: 80
MARK 5: 75
SUM: 405
AVG: 81
TC #1
MARK 1: 50
MARK 2: 60
MARK 3: 55
MARK 4: 45
MARK 5: 49
SUM: 259
AVG: 51.8

TC #1: (12/19)*100 = 63%


0%

in 5 Subjects : ");

50

75

100

50

75

100

TC #2: (16/19)*100 = 84%


0%

25

2. DECISION COVERAGE

TC #1

TC #1

MARK 1: 80
MARK 2: 80
MARK 3: 90
MARK 4: 80
MARK 5: 75
SUM: 405
AVG: 81

MARK 1: 50
MARK 2: 60
MARK 3: 55
MARK 4: 45
MARK 5: 49
SUM: 259
AVG: 51.8

TC #3

TC #4

MARK 1: 65
MARK 2: 80
MARK 3: 90
MARK 4: 70
MARK 5: 75
SUM: 380
AVG: 76

MARK 1: 40
MARK 2: 35
MARK 3: 40
MARK 4: 30
MARK 5: 40
SUM: 185
AVG: 37

4
5

TC #5

MARK 1: 0
MARK 2: -5
MARK 3: -15
MARK 4: -10
MARK 5: -15
SUM: -45
AVG: -9

10

F
13

F
F

15

11

12

T
14

T
16

17

T
18

19

3. BOUNDARY INTERIOR COVERAGE


1

11 -> 12 -> 19
11 -> 13 -> 15 -> 17 -> 19
-> 11
11 -> 13 -> 14 -> 17 ->19
-> 11

11 -> 13 -> 15 -> 16 -> 19


-> 11

11 -> 13 -> 15 -> 17 ->18


-> 19 -> 11

10

F
13

F
F

15

11

12

T
14

T
16

17

T
18

19

You might also like