White Box test design and measurement techniques
•techniques defined
–Statement testing
–Branch / Decision testing
–Data flow testing
–Branch condition testing
–Branch condition combination testing
–Modified condition decision testing
–LCSAJ testing
•also defines how to specify other techniques
Also a measurement
technique?
Using structural coverage
Spec
Enough
tests?
What's
covered
More tests
Stronger structural techniques (different structural elements)
Coverage OK?
Increasing coverage
The test coverage trap
The test coverage trap
Function exercised,
insufficient structure
Functional
testedness
Bettertesting
Functional
testedness
Structure exercised,
insufficient function
Statement
Branch
Condition
Combination
100% coverage doesnot mean 100% tested!
Coverage indicates thoroughnessbut is not equal to thoroughness
Statement coverage
Statement coverage
is normally measured
by a software tool.
•percentage of executable statements exercised by a test suite
number of statements exercised
total number of statements
•example:
–program has 100 statements
–tests exercise 87 statements
–statement coverage = 87%
Typical ad hoc testing achieves 60 - 75%
Example of statement coverage
As all 5 statements are ‘covered’ by
this test case, we have achieved
100% statement coverage
Statement
numbers
Decision coverage(Branch coverage)
Decision coverage
is normally measured
by a software tool.
•percentage of decision outcomesexercised by a test suite
number of decisions outcomes exercised
total number of decision outcomes
•example:
–program has 120 decision outcomes
–tests exercise 60 decision outcomes
–decision coverage = 50%
Typical ad hoc testing achieves 40 - 60%
Paths through code
Paths through code with loops
for as many times as it
is possible to go round
the loop (this can be
unlimited, i.e. infinite)
Partial ordering of structural coverage
Where:
All Paths = Path Coverage
L= LCSAJ
B = Branch/Decision Coverage
S = Statement Coverage
BCC = Branch Condition Combination Coverage
MCDC = Modified Condition Decision Coverage
BC = Branch Condition Coverage
How many test cases required?
•can calculate the minimum number
–to achieve statement coverage and branch coverage
•in a control flow diagram
–for statement coverage
•need enough test cases to ‘cover’ all the ‘boxes’
–for branch / decision coverage
•need enough test cases to ‘cover’ all the ‘lines’
Tips
Cyclomatic
complexity
Minimum no. of
tests to achieve 100%
Branch Coverage/
Decision Coverage
Minimum no. of
tests to achieve 100%
Statement Coverage
Statements only, no decisions
Read A
Read B
Print “Sum is”
Print A + B
Print “Product is”
Print A*B
ELSE’s = 0 + 1 = 1 = SC
Indentations (Tabs) = 1 = BC
sequence - treat as a single statement
–cyclomatic complexity: __1___
–minimum tests to achieve:
•statement coverage: ___1___
•branch coverage: ___1__
One decision, no ELSE
–cyclomatic complexity: _____
–minimum tests to achieve:
•statement coverage: ______
•branch coverage: _____
Otherwise
(ELSE
–cyclomatic complexity: _____
–minimum tests to achieve:
•statement coverage: ______
•branch coverage: _____
One decision with ELSE
–cyclomatic complexity: _____
–minimum tests to achieve:
•statement coverage: ______
•branch coverage: _____
Self-draw 1
Draw the
diagram
in your
notes
–cyclomatic complexity: _____
–minimum tests to achieve:
•statement coverage: ______
•branch coverage: _____
No hay comentarios.:
Publicar un comentario