SQAT - Ch.06 - Unit Testing
SQAT - Ch.06 - Unit Testing
SOFTWARE
SOFTWARE QUALITY
ENGINEERING
AND TESTING
(UNDERGRADUATE)
CSC 4133
(UNDERGRADUATE)
Chapter 6: Unit Testing
MMH S.2
UNIT TESTING
Tests a small software unit at a time, which is typically performed by the individual programmer
who implemented the unit prior to Integration testing
Unit Testing is usually performed by using the White Box Testing method
Lower level/ initial level testing
- Walkthrough (informal)
- Code Inspection (formal)
Black-box and White-box testing
Chapter 6: Unit Testing
MMH S.4
The low-level design document provides guidance for selection of input test data
Chapter 6: Unit Testing
MMH S.9
DEBUGGING TECHNIQUES
❑ Identify the error and potential cause of error (hypothetical hidden errors)
❑ Brute force testing
most common; but least efficient
memory dumps are taken, run-time traces are invoked, and the program is loaded with
output statements
❑ Backtracking
common debugging approach that can be used successfully in small programs
source code is traced backward (manually) until the cause is found
❑ Cause elimination
a “cause hypothesis” is devised
if initial tests indicate that a particular cause hypothesis shows promise, data are refined in
an attempt to isolate the bug (c/a-b where the possibility of a-b is zero)
Chapter 6: Unit Testing
MMH S.12
UNIT TESTING IN EXTREME PROGRAMMING
❑ Pair programming in XP
1. Pick a requirement (i.e. story)
2. Write a test case that will verify a small part
of the story and assign a fail verdict to it
3. Write the code that implement particular
part of the story to pass the test
4. Execute all tests
5. Rework on the code, and test the code until
all tests pass
6. Repeat step 2 to step 5 until the story is fully
implemented
Chapter 6: Unit Testing
MMH S.13
UNIT TESTING
REFERENCES
❑ Software Testing And Quality Assurance – Theory and Practice - Kshirasagar Naik & Priyadarshi
Tripathy
❑ Software Quality Engineering: Testing, Quality Assurance and Quantifiable Improvement - Jeff Tian