NivaarExam PrepOfficial exam papers ↗

19-Soft-A6 Software Quality Assurance · May 2018

Question 4 of 8

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

Notes on this paper

04-Soft-A6, Software Quality Assurance — National Exams, May 2018 (3 hours, open book, 8 questions of equal value; the first FIVE as they appear in the answer book are marked — all eight are solved here as a study resource).

Reference texts: Pressman, Software Engineering: A Practitioner's Approach, 9th ed. (SQA planning, review, testing strategies/techniques, software metrics, reliability & safety); Sommerville, Software Engineering, 10th ed. (software process, configuration management); ISO/IEC 25010 SQuaRE (software quality characteristics); ISO/IEC 12207 (life-cycle/configuration-management processes).

Question 4 (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.

Part (a) — unit testing techniques.

Part (b) — comparing the three techniques. Traditional functional testing is the cheapest to design and works well for stateless, procedural units, but it is weak against encapsulated, history-dependent behaviour: a method can return the "correct" output for a given input in isolation yet still be broken with respect to the object's state, and functional testing alone will not notice. Object-oriented testing addresses this by widening the unit under test to the class and its immediate collaborators, which finds integration-like defects earlier (at "unit" test time) but is correspondingly harder to fully isolate — a class can rarely be tested with total independence from the objects it collaborates with, so test doubles/stubs are usually required. State-based testing is the most targeted of the three: it is the only technique of the three that explicitly checks behaviour that depends on the unit's history (has this object already been initialized/closed/committed?), which neither plain functional testing (which treats each call independently) nor generic OO testing (which may exercise states only incidentally) is guaranteed to cover. In practice the three are complementary rather than competing: OO unit testing typically incorporates functional test-case design for each operation and state-based test-case design for the class's lifecycle, because a purely functional view of an object's methods cannot confirm that invalid state transitions are correctly rejected.