Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Lecture 24
Testing Strategies and Debugging g g gg g
CSC207 Lecture 24
Test Strategies
1. 2. 3. 4. 4
TEST PLAN
CSC207 Lecture 24
1.
Unit Testing
Focuses on unit (e.g. object (class) & module) May use static/dynamic testing techniques Static e.g. desk checking, compilation Dynamic - white/black box testing
CSC207 Lecture 24
Object (n/a)
Object (n/a)
Object Stub
CSC207 Lecture 24
TransactionTransaction-based
CSC207 Lecture 24
Another Example:
Register for exam candidate
2:Verify AU reqmts 3:Check attendance
:AU system
:Attendance Monitor M it
CSC207 Lecture 24
CSC207 Lecture 24
CSC207 Lecture 24
CSC207 Lecture 24
DRIVER
MODULE
STUB
STUB
CSC207 Lecture 24
Easier debugging
Requires scheduling
CSC207 Lecture 24
2.
Integration Testing
Non-incremental Incremental
CSC207 Lecture 24
Components are first unit tested Assembly of every components at the same time Suitable for small to moderate sized systems
CSC207 Lecture 24
Disadvantages: Di d
Excessive use of test harness Debugging is harder Concentrated use of limited resources No flexibility in scheduling
CSC207 Lecture 24
CSC207 Lecture 24
Example 1:
1:Register
:Candidate Administration
2:Verify AU reqmts
3:Check attendance
:AU system
:Attendance Monitor
CSC207 Lecture 24
Example 2: p
:e-Retail Central 1:Order
2:Check souvenir info
:Customer Customer
CSC207 Lecture 24
Example 3:
:HotelMS
bottleneck
:Guests
:Booking
:Rooms
3:update
2:check status
:Walk-ins
:Tourists
1:enquire 1:block book
CSC207 Lecture 24
Guided by Structure Chart Top-Down (Depth or Breadth) Bottom-Up (Depth, Breadth or Cluster) Sandwich Approach
CSC207 Lecture 24
Top-Down (D th Fi t) T D (Depth-First)
A TOPB C D DOWN
CSC207 Lecture 24
A TOPB C D DOWN
CSC207 Lecture 24
A BOTTOMUP B C D
CSC207 Lecture 24
A BOTTOMUP B C D
CSC207 Lecture 24
BottomBottom-Up (Cluster)
A BOTTOMUP B C D
CSC207 Lecture 24
SANDWICH B C D
CSC207 Lecture 24
SANDWICH B C D
CSC207 Lecture 24
3.
Validation Testing
Black box testing SQA checks conformance to SRS h k f t Acceptance tests
alpha
CSC207 Lecture 24
4.
System Testing
After installation and commissioning i i i Focus on daily operations Black box testing
e.g. g
CSC207 Lecture 24
Debugging D b i
1. 2. 2 3.
CSC207 Lecture 24
1.
Brute force
Memory Dumps WRITE or PRINT statements Least efficient (used when all else fails)
CSC207 Lecture 24
2.
Backtracking
Begin at error discovery point Manually trace source code backwards Suitable for small to moderate-sized programs
CSC207 Lecture 24
3.
Cause Elimination
By induction or deduction Devise cause hypothesis cause hypothesis Organise test cases to isolate potential causes Suitable for larger programs or subsystems
CSC207 Lecture 24
breakpoints, b k i t stepping
Program symbol table
Execution Controller
CSC207 Lecture 24
Summary
Test Strategy organization of tasks Tasks: unit, integration, validation, system Unit testing: requires test harness Integration for OO systems: stimulus order Integration for FO systems: SC guides order Validation & Sys e Testing a da o System es g