This lesson puts EP (5.2), BVA (5.3) and positive/negative tests together on the professor’s second big example. Follow it step by step: it is the shape of a complete EP answer, and the professor told the class to work through it themselves.
From the slides: the specification.
The exam mark is out of 75. The coursework mark is out of 25.
Total = exam + coursework (out of 100).
Total ≥70 → A. 50 to under 70 → B. 30 to under 50 → C. Under 30 → D.
If a mark is outside its range → fault message (FM).
All inputs are integers.
Step 1: Partitions from the Ranges
Each mark is a range, so each gets 1 valid + 2 invalid partitions (the first guideline of 5.2).
The input partitions on a number line. Watch the = signs: 0, 75 and 25 are valid.
Step 2: Partitions from the Type
All inputs must be integers, so a non-integer is invalid. The professor picked two kinds of wrong type: a real number (like 30.5) and a letter (like 'Q'). That adds 2 more invalid partitions for each mark. The ranges alone would never have found these: 30.5 is “inside” 0 to 75, yet it is not a legal input.
Step 3: Partitions from the Output
Do not forget the output! The total mark decides the grade, and the output values form partitions of their own along the total-mark line:
Output partitions on the total-mark line. FM = fault message.
Be careful with the edges: 70 gives A, but 69 gives B; 50 gives B, but 49 gives C; 30 gives C, but 29 gives D. These are exactly the places BVA will aim at.
Outputs that should never appear
There are also outputs the specification never mentions, so the program must never produce them: for example E, A+, or an empty (null) result. These are invalid output partitions. How many of them should you list? The professor said: enough until you feel confident, but not so many that you waste time. In this example, 3.
All the Partitions Together: 19
#
What
Partition
Valid or invalid?
1
Exam mark
0 to 75
Valid
2
Exam mark
less than 0
Invalid
3
Exam mark
more than 75
Invalid
4
Exam mark
a real number (e.g. 30.5)
Invalid
5
Exam mark
a letter (e.g. 'Q')
Invalid
6
Coursework mark
0 to 25
Valid
7
Coursework mark
less than 0
Invalid
8
Coursework mark
more than 25
Invalid
9
Coursework mark
a real number
Invalid
10
Coursework mark
a letter
Invalid
11
Output
A (total 70 to 100)
Valid
12
Output
B (total 50 to 69)
Valid
13
Output
C (total 30 to 49)
Valid
14
Output
D (total 0 to 29)
Valid
15
Output
FM (total less than 0)
Valid
16
Output
FM (total more than 100)
Valid
17
Output
E (never specified)
Invalid
18
Output
A+ (never specified)
Invalid
19
Output
null / empty (never specified)
Invalid
The two FM outputs are valid outputs: the specification asks for a fault message in those situations, so producing it is correct behaviour.
Step 4: From Partitions to Test Cases
First, write at least one test case per partition, and every one must include its expected output. The professor’s first test case was:
exam = 44, coursework = 15 → total = 59 → expected output B.
One test per partition gives 19 test cases. Can we do better? Yes. Look at the test above: it covers three partitions at once, the valid exam mark (#1), the valid coursework mark (#6) and output B (#12). When partitions overlap like this, one test can cover several of them. By choosing tests carefully, the slides reduce the 19 tests to 11.
Combining safely: valid freely, invalid one at a time
How far can you combine? The safe rule is: combine valid partitions freely, but test invalid inputs one at a time. If one test contains two bad inputs, the first error message can hide the second: the program may reject the exam mark and never even look at the coursework mark, so a missing check on the coursework goes unnoticed. This is the same idea as masking in MC/DC (3.5).
Following that rule gives a reduction you can always defend, 12 tests:
Test
Exam
Coursework
Total
Expected
Partitions covered
1
60
20
80
A
#1, #6, #11
2
44
15
59
B
#1, #6, #12
3
30
10
40
C
#1, #6, #13
4
10
5
15
D
#1, #6, #14
5
−10
5
−5
FM
#2, #15
6
80
25
105
FM
#3, #16
7
30.5
10
–
FM
#4
8
'Q'
10
–
FM
#5
9
40
−1
–
FM
#7
10
40
30
–
FM
#8
11
40
12.5
–
FM
#9
12
40
'Q'
–
FM
#10
Tests 1–4 are the positive tests: both inputs valid, one test per grade.
Tests 5–12 are the negative tests, one per invalid input partition, each with only one bad input. Tests 5 and 6 are chosen so that their totals (−10+5=−5 and 80+25=105) also land in the two FM output partitions, which saves two tests.
Partitions #17–#19 (E, A+, null) need no test of their own: they are checked by confirming that no test ever produces them.
Check: every one of the 19 partitions appears in the last column or in the E/A+/null check ✓. The slides go one step further, to 11, by letting tests cover even more overlapping partitions; the 12-test version keeps every invalid input alone, so no error message can mask another.
Exam radar: EP is for input and output. A complete EP answer includes: valid and invalid ranges, invalid types (real number, letter), valid outputs (A, B, C, D, FM) and unspecified outputs (E, A+, null). Then reduce the number of tests by covering overlapping partitions together.
Common mistake: stopping after the input ranges. Many answers list only “exam valid / below / above” and “coursework valid / below / above” (6 partitions) and forget the types, the outputs and the outputs that should never appear, which is 13 of the 19 partitions.
Worked Examples
Exercise 1
Why does the grade example include outputs like E and A+?
Show solution ↓Hide solution ↑
Solution
Because EP covers outputs too, not only inputs. E and A+ are never mentioned in the specification, so the program must never produce them: they are invalid output partitions. We check that no test ever produces them. If one did (say a total of 100 printed “A+”), we would have found a bug.
Exercise 2
Exam = 44 and coursework = 15. Work out the expected output and list which of the 19 partitions this single test covers.
Show solution ↓Hide solution ↑
Solution
Both marks are in range (0≤44≤75 and 0≤15≤25) and both are integers, so the input is valid.
total=44+15=59
59 is in “50 to under 70”, so the expected output is B.
It covers #1 (valid exam mark), #6 (valid coursework mark) and #12 (output B): three partitions with one test.
Exercise 3
A student combines two invalid inputs into one test: exam = 80, coursework = 'Q', expected FM. The program shows “fault message”. Has the student shown that the coursework type check works? Explain.
Show solution ↓Hide solution ↑
Solution
No. Exam = 80 is already outside its range, so a fault message is expected from the exam mark alone. The program may have rejected the exam mark first and never checked the coursework at all. The first error masks the second, just like masking in MC/DC: we cannot tell which check produced the result.
To show the coursework type check works, test it alone with a valid exam mark, for example exam = 40, coursework = 'Q' → expected FM. That is why the safe rule is: combine valid partitions freely, but test invalid inputs one at a time.
Exercise 4
Apply BVA to the grade calculator. Give the boundary values for both input marks, and pairs of valid inputs that test each grade edge on the total-mark line.
Show solution ↓Hide solution ↑
Solution
Inputs (on, just below, just above each edge):
Exam mark (0 to 75): −1, 0, 1 and 74, 75, 76.
Coursework mark (0 to 25): −1, 0, 1 and 24, 25, 26.
Output edges (keep both inputs valid, so only the total changes):
Edge
Test (exam, coursework)
Total
Expected
D / C
(20, 9)
29
D
(20, 10)
30
C
C / B
(40, 9)
49
C
(40, 10)
50
B
B / A
(50, 19)
69
B
(50, 20)
70
A
lowest valid total
(0, 0)
0
D
highest valid total
(75, 25)
100
A
Each pair sits on either side of a grade edge, so a programmer who wrote total > 70 instead of total >= 70 is caught by (50, 20) → expected A.
Exercise 5
Classify each test as positive or negative and give the expected output: (a) exam 75, coursework 25; (b) exam 0, coursework 0; (c) exam 76, coursework 0; (d) exam 30, coursework 25.5.
Show solution ↓Hide solution ↑
Solution
Test
Inputs valid?
Total
Kind
Expected
(a) 75, 25
both valid (on the upper edges)
100
positive
A
(b) 0, 0
both valid (on the lower edges)
0
positive
D
(c) 76, 0
exam above 75
–
negative
FM
(d) 30, 25.5
coursework not an integer
–
negative
FM
Note (a) and (b): the edges 75, 25 and 0 are valid, because the ranges include their end points (0≤ mark ≤75).
Exercise 6
Exam-style: “Use equivalence partitioning to design test cases for the grade calculator.” Outline what a complete answer must contain.
Show solution ↓Hide solution ↑
Solution
A complete answer has four parts:
Input partitions from the ranges: exam 0 to 75 valid, below 0 and above 75 invalid; coursework 0 to 25 valid, below 0 and above 25 invalid.
Input partitions from the type: for each mark, a real number and a letter are invalid.
Output partitions: A, B, C, D, FM (total below 0), FM (total above 100) are valid outputs; E, A+ and null are unspecified, invalid outputs. That makes 19 partitions in all.
Test cases with expected outputs, reduced by covering overlapping partitions: valid partitions combined freely (for example (44, 15) → B covers #1, #6, #12), each invalid input tested on its own, and a statement that no test may produce E, A+ or null.
The 12-test set in the lesson is one such answer; adding the BVA values of Exercise 4 makes it stronger.