NivaarExam PrepOfficial exam papers ↗

19-Soft-A6 Software Quality Assurance · December 2013

Question 4 of 8: Unit Testing Techniques and Equivalence Classes

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

Notes on this paper

National Exams, December 2013 — 04-Soft-A6, Software Quality Assurance (open book, non-communicating calculator permitted, 3 hours). Per the paper's own notes, FIVE of the EIGHT questions constitute a complete exam and each is of equal value; all eight are answered in full below as a complete study resource.

Reference texts. Pressman, Software Engineering: A Practitioner's Approach, 9th ed., Ch. 15 (SQA), Ch. 17–18 (unit/integration/validation/system testing strategy), Ch. 19–20 (white-box basis-path testing, black-box equivalence partitioning & boundary value analysis); Sommerville, Software Engineering, 10th ed., Ch. 8 (Software Testing) and Ch. 24 (Quality Management); SWEBOK v4, Software Quality KA and Software Testing KA; ISO/IEC 25010 (SQuaRE) for the software product quality model referenced in Question 1; ISO/IEC/IEEE 12207 (Software life cycle processes) for the process-standard referenced in Question 1(b).

Question 4: Unit Testing Techniques and Equivalence Classes (10 marks)

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.

(a) Unit testing techniques

Unit testing techniques fall into two families. White-box (structural) testing derives test cases from the module's internal logic/source code, independent of the specification: basis path testing uses the module's cyclomatic complexity V(G) to derive a minimum set of independent execution paths (Question 6 works a full example); condition testing exercises the true/false outcome of every logical condition in a decision; data-flow testing selects paths according to where variables are defined and subsequently used; loop testing targets simple, nested, concatenated, and unstructured loops specifically at their boundaries (zero, one, and many iterations) — the class of case that a single basis-path pass through DisplayProps()'s or SearchProps()'s for loop does not, by itself, guarantee is fully exercised.

Black-box (functional) testing derives test cases from the module's specification/interface, independent of its internal code: equivalence partitioning groups the input domain into classes expected to be handled alike (part (b) below); boundary value analysis targets the edges of those classes, where off-by-one defects concentrate (Question 5 works a full example); cause-effect graphing and orthogonal-array testing systematically combine multiple input conditions to catch defects that arise only from specific combinations.

Compared and contrasted: white-box testing guarantees a defined level of internal structural coverage (e.g. every independent path executed at least once) but says nothing about whether the code implements the correct requirement, since it never consults the specification; black-box testing checks conformance to the specification and is blind to internal structure, so it can miss an internal path that a white-box pass would have caught, but is far better at catching missing or incorrectly-implemented functionality. A thorough unit test plan uses both together, as Questions 5 and 6 do for the same Appendix A program.

(b) The four equivalence classes (guideline categories)

Equivalence partitioning derives its classes from the type of input condition being tested, and four guideline categories are standard: (1) if an input condition specifies a range, one valid class (inside the range) and two invalid classes (below it, above it) are defined; (2) if an input condition requires a specific value, one valid class (that value) and two invalid classes (any value less than, and any value greater than, it) are defined; (3) if an input condition specifies membership of a set, one valid class (a member) and one invalid class (a non-member) are defined; (4) if an input condition is Boolean, one valid class and one invalid class are defined. Question 5 applies category (1) — range — to both the username-length and password-length conditions, and applies category (4)-like single-condition partitioning to each of the password's three character-composition requirements.