Professional Documents
Culture Documents
Software Quality Engineering: Wrap-Up Conclusion
Software Quality Engineering: Wrap-Up Conclusion
Week 8
Agenda
Wrap-up
Conclusion
– Structural Testing
– Unit Testing
From Unit to Integration Testing
– OO Protocol Testing
– Finite State Machines for Testing
OO Protocol
Procedural software
– unit = single program, function, or procedure
Object oriented software
– unit = class, class methods
– unit testing = intra-class testing
– integration testing = inter-class testing (cluster of
classes)
dealing with single methods separately is usually
– too expensive (complex scaffolding)
Therefore, methods are usually tested in the
context of the class they belong to
Arranging transitions
Initial -> Empty: action = “create”
– e.g. “s = new Stack()” in Java
Empty -> Holding: action = “add”
Empty -> Full: action = “add”
– if MAXcapacity=1
Empty -> Final: action = “destroy”
– e.g. destructor call in C++, garbage collection in
Java
Holding -> Empty: action = “delete”
– if s.size() = 1
Coverage Criteria
We can choose one or more of the following test
selection criteria:
All states – testing passes through all states
All events – testing forces all events to occur
at least once
All actions – testing forces all actions to be
produced at least once
Test Strategies
Possible strategies
– All round-trip paths
– All transition sequences beginning and ending in
the same state
– All simple paths from initial to final state
This strategy will help you to find
– All invalid or missing states
– Some extra states
– All event an action faults
/pass
/start
Select Item Confirm Order
/reset /purchase
/continue
Idle
Confirm Delivery
Add to Cart
Addr
#(Item) = 10 /proceed /proceed
/cancel
Checkout Receive Payment
We adopt
S No Intent Inputs Exp Output Pre-Cond Post-Cond
/pass
/start
Select Item Confirm Order
/reset /purchase
Idle
/continue
Confirm Delivery
Add to Cart
Addr
#(Item) = 10 /proceed /proceed
/cancel
Checkout Receive Payment
/pass
/start
Select Item Confirm Order
/reset /purchase
/continue
Idle
Confirm Delivery
Add to Cart
Addr
#(Item) = 10 /proceed /proceed
/cancel
Checkout Receive Payment
/fail
Identify User /fail
/pass
/start
Select Item Confirm Order
/reset /purchase
Idle
/continue
Confirm Delivery
Add to Cart
Addr
#(Item) = 10 /proceed /proceed
/cancel
Checkout Receive Payment
/pass
/start
Select Item Confirm Order
/reset /purchase
Idle
/continue
Confirm
Add to Cart
Delivery Addr
#(Item) = 10 /proceed /proceed
/cancel
Receive
Checkout
Payment
status = OK && Qty > ordered
Press Enter
2 Valid user Enter U name Valid User Idle State Select Item
purchasing Enter Passwd state
Press Enter Cart Empty
3 Select items Select Item Valid User Valid user Select item
Add to Cart identified
Continue Cart Not
Empty Select
item
4 Possible Sneak path, found due to lack of system check
Sequence: Idle Identify User Idle
Sequence: Idle Identify User select Item
Sequence: Select Item Select item
Users needs
System Under Test ? (Requirements)
Objectives (specific)
Informal specification
Formal specification
We intend to understand what should be the relation
between SUT and its specification that will allow us
to draw test cases from model and test SUT
The answer will help test team to establish a clear
relationship between system under test,
specification and objective to satisfy.
Conformance Testing
conformance relation
abstract abstract
model of S model of I
assumptions/ assumptions/
test hypothesis test hypothesis
conformance relation
precise
implementation I
specification S
Question?
What if Account
– we have concept level status: enum
balanace: int
documents to consider isActive(): boolean
– Could be isBlocked(): boolean
isClosed(): boolean
UML documents gotBalance(): int
Specifications block()
unblock()
etc. close()
deposit(amount: int)
withdraw(amount: int)
Answer!
We develop state-machines considering these
artifacts…
But how…
Account
status: enum
balanace: int
isActive(): boolean
isBlocked(): boolean
isClosed(): boolean
gotBalance(): int
block()
unblock()
close()
deposit(amount: int)
withdraw(amount: int)
Fault Models
A fault model is a hypothetical model of what types of faults
may occur in an implementation
– Most fault models are "structural", i.e. the model is a refinement of
the specification formalism (or of an implementation model)
E.g. mutations of the specification or of a correct implementation
– It may be used to construct the fault domain used for defining what
"complete test coverage" means
E.g. single fault hypothesis (or multiple faults)
A fault model is useful for the following problems:
– Test suite development for given coverage objective
– Formalization of "test purpose"
– For existing test suite: coverage evaluation and optimization
– Diagnostics
Summary
Unit Testing – Conclusion
OO Protocol Testing
State-Machine based testing
Model-based testing
Next Lectures
– Specification-based Testing
– Grey-box testing: An Introduction
– Testing Classes Clusters
Method-Message Path Testing
– Testing Object-Oriented Systems