Back to the 2026 paper

Module 4: Software Testing

20267m

A program accepts marks from 0 to 100. Construct test cases using Boundary Value Analysis and Equivalence Class Testing and compare the resulting test sets.

Worked SolutionAI Assisted

Test Cases for Marks (0 to 100): BVA and Equivalence Class Testing

Valid range: 0 <= marks <= 100 (integers). Anything else must be rejected with an error message.

1. Boundary Value Analysis (BVA)

Test at and around each boundary (min-1, min, min+1, nominal, max-1, max, max+1):

TC Input Expected output
B1 -1 Invalid (just below minimum)
B2 0 Valid (minimum)
B3 1 Valid (just above minimum)
B4 50 Valid (nominal)
B5 99 Valid (just below maximum)
B6 100 Valid (maximum)
B7 101 Invalid (just above maximum)

Total = 7 test cases (robust BVA). Standard BVA without the two invalid values has 5.

2. Equivalence Class Testing (ECT)

Divide the input domain into classes whose members behave alike; test one value per class.

Class Range Type Representative input Expected output
EC1 marks < 0 Invalid -20 Error
EC2 0 to 100 Valid 55 Accepted
EC3 marks > 100 Invalid 150 Error

Non-integer or non-numeric input (e.g. "abc") can be added as a further invalid class.

Total = 3 test cases (4 with the non-numeric class).

3. Comparison of the test sets

Basis BVA Equivalence class testing
Number of tests 7 3
Focus Edges of ranges, where off-by-one errors occur (e.g. < written instead of <=) Whole classes of input, one representative each
Defect finding Strong for boundary errors Strong for general class errors, weak at boundaries
Redundancy Higher Minimal

Example: if the code wrongly checks marks < 100, ECT value 55 passes but BVA input 100 exposes the bug.

Conclusion

ECT reduces the number of tests; BVA finds boundary defects. Using them together (for example 3 + the boundary values) gives better coverage with a small test set.

Similar questions

AI LearningWeb Platform

Coursify — Personal AI Course Generator

Struggling with a difficult subject or concept? Turn any engineering topic into a structured course with interactive lessons, quizzes, and research-backed explanations.