Nivaar Exam Prep

25-Comp-B11 Advanced Software Design · May 2016

Question 28 of 28: Boundary Value Analysis for a Price Input

Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer) · Last updated

Notes on this paper

Reference texts: Sommerville, Software Engineering (10th ed., Pearson) — software processes, requirements engineering, agile methods, design principles, dependability; Pressman, Software Engineering: A Practitioner's Approach (9th ed.) — supplementary process and quality coverage; Gamma, Helm, Johnson & Vlissides (GoF), Design Patterns: Elements of Reusable Object-Oriented Software — creational/structural/behavioural pattern catalogue (Singleton, Proxy, Template Method, Observer, etc.); Sebesta, Concepts of Programming Languages (12th ed.) — polymorphism, dynamic binding, inheritance and language-level object semantics; Bertrand Meyer, Object-Oriented Software Construction — design by contract, preconditions/postconditions/invariants, the open–closed principle; Barbara Liskov's 1987 substitutability paper for Question 11; Rogers, Sharp & Preece, Interaction Design, and Nielsen, Usability Engineering, for Question 21's HMI-specific non-functional requirements; Myers, The Art of Software Testing, for Question 28's boundary value analysis.

PART I — General Principles

Question 28: Boundary Value Analysis for a Price Input (Part V)

Question text not reproduced: the examination questions are © Engineers and Geoscientists BC. Open the official past paper (linked at the top of this page) to read the question, then follow the worked solution below.

Check

Since E is missing a data point regardless of what that value would have been, it cannot be evaluated as a complete test set and is excluded from consideration below on that basis alone, independent of its other three values.

Approach. The valid input domain is the closed interval [$10.00, $1,200.00]. Boundary Value Analysis (BVA) is the standard technique for choosing a small, high-yield set of test inputs for a bounded numeric input: rather than sampling arbitrary interior points, BVA specifically targets the boundary itself and its immediate neighbourhood, since off-by-one errors in range-checking code (> instead of ≥, < instead of ≤) manifest exactly at a boundary and nowhere else. A complete BVA set for a single bounded range covers five distinct classes: a value just BELOW the minimum (invalid), the minimum itself (valid boundary), a NOMINAL interior value (valid), the maximum itself (valid boundary), and a value just ABOVE the maximum (invalid).

Classifying each option's values against the valid range [$10.00, $1,200.00]
OptionValuesClasses coveredBoundaries hit?
A6.00, 9.00, 55.00, 900.00invalid-low (x2), nominal (x2)Neither boundary tested
B8.50, 150.00, 1200.00invalid-low, nominal, boundary-maxMax only; no invalid-high, no boundary-min
C5.12, 10.00, 500.00, 1200.00, 1500.30invalid-low, boundary-min, nominal, boundary-max, invalid-highBoth boundaries tested, with an invalid neighbour on each side
D5.00, 600.00, 1300.00, 1500.00invalid-low, nominal, invalid-high (x2)Neither boundary tested; redundant second invalid-high

Selection: Option C. Only C exercises all five BVA classes: 5.12 (just below the minimum, must be rejected), 10.00 (the minimum itself, must be accepted — this is exactly the value an off-by-one >-instead-of-≥ bug would wrongly reject), 500.00 (an ordinary interior value, confirming the "obviously valid" case also works), 1,200.00 (the maximum itself, must be accepted — the value an off-by-one <-instead-of-≤ bug would wrongly reject), and 1,500.30 (just above the maximum, must be rejected). Every other option leaves at least one boundary untested: A tests neither boundary and both its invalid values sit well below the minimum rather than adjacent to it; B tests only the upper boundary and supplies no invalid-high case at all; D tests neither exact boundary value and wastes a test on a second, redundant invalid-high value that adds no new coverage.

ItemResult
Valid range$10.00 ≤ price ≤ $1,200.00
BVA classes neededinvalid-low, boundary-min, nominal, boundary-max, invalid-high (5 classes)
Best selectionOption C — the only set covering all 5 classes
Back to the paper →