Introduction to Software Testing
Chapter 1
Model-Driven Test Design
Paul Ammann & Jeff Offutt
[Link]
Types of Test Activities
Testing can be broken up into four general types of activities
1. Test Design 1.a) Criteria-based
2. Test Automation 1.b) Human-based
3. Test Execution
4. Test Evaluation
Each type of activity requires different skills, background
knowledge, education and training
No reasonable software development organization uses the same
people for requirements, design, implementation, integration
and configuration control
Why do test organizations still use the same people
for all four test activities??
This is clearly a waste of resources
Introduction to Software Testing (Ch 1), [Link] © Ammann & Offutt 2
1. Test Design – (a) Criteria-Based
Design test values to satisfy coverage criteria
or other engineering goal
This is the most technical job in software testing
Requires knowledge of :
– Discrete math
– Programming
– Testing
Requires much of a traditional CS degree
This is intellectually stimulating, rewarding, and challenging
Test design is analogous to software architecture on the
development side
Using people who are not qualified to design tests is a sure way to
get ineffective tests
Introduction to Software Testing (Ch 1), [Link] © Ammann & Offutt 3
1. Test Design – (b) Human-Based
Design test values based on domain knowledge of
the program and human knowledge of testing
This is much harder than it may seem to developers
Criteria-based approaches can be blind to special situations
Requires knowledge of :
– Domain, testing, and user interfaces
Requires almost no traditional CS
– A background in the domain of the software is essential
– An empirical background is very helpful (biology, psychology, …)
– A logic background is very helpful (law, philosophy, math, …)
This is intellectually stimulating, rewarding, and challenging
– But not to typical CS majors – they want to solve problems and build
things
Introduction to Software Testing (Ch 1), [Link] © Ammann & Offutt 4
2. Test Automation
Embed test values into executable scripts
This is slightly less technical
Requires knowledge of programming
– Fairly straightforward programming – small pieces and simple algorithms
Requires very little theory
Very boring for test designers
Programming is out of reach for many domain experts
Who is responsible for determining and embedding the expected
outputs ?
– Test designers may not always know the expected outputs
– Test evaluators need to get involved early to help with this
Introduction to Software Testing (Ch 1), [Link] © Ammann & Offutt 5
3. Test Execution
Run tests on the software and record the results
This is easy – and trivial if the tests are well automated
Requires basic computer skills
– Interns
– Employees with no technical background
Asking qualified test designers to execute tests is a sure way to
convince them to look for a development job
If, for example, GUI tests are not well automated, this requires a
lot of manual labor
Test executors have to be very careful and meticulous with
bookkeeping
Introduction to Software Testing (Ch 1), [Link] © Ammann & Offutt 6
4. Test Evaluation
Evaluate results of testing, report to developers
This is much harder than it may seem
Requires knowledge of :
– Domain
– Testing
– User interfaces and psychology
Usually requires almost no traditional CS
– A background in the domain of the software is essential
– An empirical background is very helpful (biology, psychology, …)
– A logic background is very helpful (law, philosophy, math, …)
This is intellectually stimulating, rewarding, and challenging
– But not to typical CS majors – they want to solve problems and build
things
Introduction to Software Testing (Ch 1), [Link] © Ammann & Offutt 7
Other Activities
Test management : Sets policy, organizes team, interfaces with
development, chooses criteria, decides how much automation is
needed, …
Test maintenance : Tests must be saved for reuse as software
evolves
– Requires cooperation of test designers and automators
– Deciding when to trim the test suite is partly policy and partly technical –
and in general, very hard !
– Tests should be put in configuration control
Test documentation : All parties participate
– Each test must document “why” – criterion and test requirement satisfied
or a rationale for human-designed tests
– Traceability throughout the process must be ensured
– Documentation must be kept in the automated tests
Introduction to Software Testing (Ch 1), [Link] © Ammann & Offutt 8
Approximate Number of Personnel
A mature test organization only one test designer to work with
several test automators, executors and evaluators
Improved automation will reduce the number of test executors
– Theoretically to zero … but not in practice
Putting the wrong people on the wrong tasks leads to
inefficiency, low job satisfaction and low job performance
– A qualified test designer will be bored with other tasks and look for a job
in development
– A qualified test evaluator will not understand the benefits of test criteria
Test evaluators have the domain knowledge, so they must be free
to add tests that “blind” engineering processes will not think of
Introduction to Software Testing (Ch 1), [Link] © Ammann & Offutt 9
Types of Test Activities – Summary
1a. Design Design test values to satisfy engineering goals
Criteria Requires knowledge of discrete math, programming and testing
1b. Design Design test values from domain knowledge and intuition
Human Requires knowledge of domain, UI, testing
2. Automatio Embed test values into executable scripts
n
Requires knowledge of scripting
3. Execution Run tests on the software and record the results
Requires very little knowledge
4. Evaluation Evaluate results of testing, report to developers
Requires domain knowledge
These four general test activities are quite different
It is a poor use of resources to use people inappropriately
Most test teams use the same people for ALL FOUR activities !!
Introduction to Software Testing (Ch 1), [Link] © Ammann & Offutt 10
Applying Test Activities
To use our people effectively
and to test efficiently
we need a process that
lets test designers
raise their level of abstraction
Introduction to Software Testing (Ch 1), [Link] © Ammann & Offutt 11
Model-Driven Test Design
refined
model / test
requirements /
structure requirements
test specs
DESIGN
ABSTRACTION
LEVEL
IMPLEMENTATION
ABSTRACTION
software LEVEL input
artifact values
pass / test test test
fail results scripts cases
Introduction to Software Testing (Ch 1), [Link] © Ammann & Offutt 12
Model-Driven Test Design – Steps
criterion refine refined
model / test
requirements /
structure requirements
test specs generate
analysis DESIGN
ABSTRACTION
LEVEL
IMPLEMENTATION
ABSTRACTION
software LEVEL input
artifact values
evaluate execute prefix
automate
pass / test test test postfix
fail results scripts cases expected
Introduction to Software Testing (Ch 1), [Link] © Ammann & Offutt 13
Model-Driven Test Design – Activities
refined
model / test
requirements /
structure requirements
test specs
Test Design DESIGN
ABSTRACTION
LEVEL
IMPLEMENTATION
Raising our abstraction level makes
ABSTRACTION
software test design MUCH easier
LEVEL input
artifact values
Test Automation
pass / test test test
fail results scripts cases
Test Test
Evaluation Execution
Introduction to Software Testing (Ch 1), [Link] © Ammann & Offutt 14
Refinement for Chapters 2 & 3
The model-driven test design process is generic
and has to be instantiated (or refined) for specific
kinds of structures
Introduction to Software Testing (Ch 1), [Link] © Ammann & Offutt 15
Model-Driven Test Design – Graphs
criterion nodes, refine
test
graph edges,
NC paths
EC
subpaths generate
PPC
analysis … DESIGN
ABSTRACTION
LEVEL
IMPLEMENTATION
ABSTRACTION
software LEVEL input
artifact values
source
statechart
use case
architecture
… evaluate execute prefix
automate
pass / test test test postfix
fail results scripts cases expected
Introduction to Software Testing (Ch 1), [Link] © Ammann & Offutt 16
Model-Driven Test Design – Logic
criterion truth refine
predicate
predicate table
CoC values
CACC
rows generate
PC
analysis CC DESIGN
ABSTRACTION
LEVEL
IMPLEMENTATION
ABSTRACTION
software LEVEL input
artifact values
source
statechart
use case
architecture
… evaluate execute prefix
automate
pass / test test test postfix
fail results scripts cases expected
Introduction to Software Testing (Ch 1), [Link] © Ammann & Offutt 17