Title: System Testing
1Rob Oshana Southern Methodist University
Software Testing
2Why do we Test ?
- Assess Reliability
- Detect Code Faults
3Industry facts
- 30-40 of errors detected after deployment are
run-time errors U.C. Berkeley,
IBMs TJ Watson Lab
- The amount of software in a typical device
doubles every 18 months Reme
Bourguignon, VP of Philips Holland
- Defect densities are stable over the last 20
years 0.5 - 2.0 sw failures / 1000 lines
Cigital Corporation
- Software testing accounts for 50 of pre-release
costs,and 70 of post-release costs
Cigital Corporation
4Critical SW Applications
- Critical software applications which have failed
- Mariner 1 NASA 1962Missing - in
ForTran code Rocket bound for Venus
destroyed - Therac 25 Atomic Energy of Canada Ltd
1985-87Data conversion error Radiation
therapy machine for cancer - Long Distance Service ATT 1990A single line of
bad code Service outages up to nine hours long - Patriot Missiles U.S. military 1991Endurance
errors in tracking system 28 US soldiers
killed in barracks - Tax Calculation Program InTuit 1995Incorrect
results SW vendor payed tax penalties for users
5Good and successful testing
- What is a good test case?
- A good test case has a high probability of
finding an as-yet undiscovered error - What is a successful test case?
- A successful test is one that uncovers an as-yet
undiscovered error
6Who tests the software better ?
Must learn about the system, but, will attempt to
break it and, is driven by quality
Understands the system but, will test
gently and, is driven by delivery
7Testability can you develop a program for
testability?
- Operability - The better it works, the more
efficiently it can be tested - Observability - the results are easy to see,
distinct output is generated for each input,
incorrect output is easily identified - Controllability - processing can be controlled,
tests can be automated reproduced - Decomposability - software modules can be tested
independently - Simplicity - no complex architecture and logic
- Stability - few changes are requested during
testing - Understandability - program is easy to understand
8(No Transcript)
9Did You Know...
- Testing/Debugging can worsen reliability?
- We often chase the wrong bugs?
- Testing cannot show the absence of faults, only
the existence? - The cost to develop software is directly
proportional to the cost of testing? - Y2K testing cost 600 billion
10(No Transcript)
11Did you also know...
- The most commonly applied software testing
techniques (black box and white box) were
developed back in the 1960s - Most Oracles are human (error prone)!!
- 70 of safety critical code can be exceptions
- this is the last code written!
12Testing Problems
- Time
- Faults hides from tests
- Test Management costs
- Training Personnel
- What techniques to use
- Books and education
13Errors are more common, more pervasive, and more
troublesome in software than with other
technologies
14What is testing?
- How does testing software compare with testing
students?
15What is testing?
- Software testing is the process of comparing the
invisible to the ambiguous as to avoid the
unthinkable. James Bach, Borland corp.
16What is testing?
- Software testing is the process of predicting the
behavior of a product and comparing that
prediction to the actual results." R. Vanderwall
17Purpose of testing
- Build confidence in the product
- Judge the quality of the product
- Find bugs
18Finding bugs can be difficult
A path through the mine field (use case)
A path through the mine field (use case)
Mine field
x
x
x
x
x
x
x
x
x
x
x
19Why is testing important?
- Therac25 Cost 6 lives
- Ariane 5 Rocket Cost 500M
- Denver Airport Cost 360M
- Mars missions, orbital explorer polar lander
Cost 300M
20Why is testing so hard?
21Reasons for customer reported bugs
- User executed untested code
- Order in which statements were executed in actual
use different from that during testing - User applied a combination of untested input
values - Users operating environment was never tested
22Interfaces to your software
- Human interfaces
- Software interfaces (APIs)
- File system interfaces
- Communication interfaces
- Physical devices (device drivers)
- controllers
23Selecting test scenarios
- Execution path criteria (control)
- Statement coverage
- Branching coverage
- Data flow
- Initialize each data structure
- Use each data structure
- Operational profile
- Statistical sampling.
24What is a bug?
- Error mistake made in translation or
interpretation ( many taxonomies exist to
describe errors) - Fault manifestation of the error in
implementation (very nebulous) - Failure observable deviation in behavior of the
system
25Example
- Requirement print the speed, defined as
distance divided by time - Code s d/t print s
26Example
- Error I forgot to account for
- t 0
- Fault omission of code to catch t0
- Failure exception is thrown
27Severity taxonomy
- Mild - trivial
- Annoying - minor
- Serious - major
- Catastrophic - Critical
- Infectious - run for the hills
What is your taxonomy ?
IEEE 1044-1993
28Life cycle
Testing and repair process can be just as error
prone as the development Process (more so ??)
Errors can be introduced at each of these stages
Requirements
Resolve
error
error
Design
Isolate
error
error
Code
Classify
error
error
Testing
error
29Ok, so lets just design our systems with
testability in mind..
30Testability
- How easily a computer program can be tested
(Bach) - We can relate this to design for testability
techniques applied in hardware systems
31JTAG
A standard Integrated Circuit
Boundary Scan cells
Boundary Scan path
Data out
Core IC Logic
cell
TDI
TDO
I/O pads
Data in
Test data out (TDO)
Test data in (TDI)
Test access port controller
Test mode Select (TMS)
Test clock (TCK)
32Operability
- The better it works, the more efficiently it can
be tested - System has few bugs (bugs add analysis and
reporting overhead) - No bugs block execution of tests
- Product evolves in functional stages
(simultaneous development and testing)
33Observability
- What you see is what you get
- Distinct output is generated for each input
- System states and variables are visible and
queriable during execution - Past system states are .. (transaction logs)
- All factors affecting output are visible
34Observability
- Incorrect output is easily identified
- Internal errors are automatically detected
through self-testing mechanisms - Internal errors are automatically reported
- Source code is accessible
35Visibility Spectrum
End customer visibility
Factory visibility
GPP visibility
DSP visibility
36Controllability
- The better we can control the software, the more
the testing can be automated and optimized - All possible outputs can be generated through
some combination of input - All code is executable through some combination
of input
37Controllability
- SW and HW states and variables can be controlled
directly by the test engineer - Input and output formats are consistent and
structured
38Decomposability
- By controlling the scope of testing, we can more
quickly isolate problems and perform smarter
testing - The software system is built from independent
modules - Software modules can be tested independently
39Simplicity
- The less there is to test, the more quickly we
can test it - Functional simplicity (feature set is minimum
necessary to meet requirements) - Structural simplicity (architecture is
modularized) - Code simplicity (coding standards)
40Stability
- The fewer the changes, the fewer the disruptions
to testing - Changes to the software are infrequent,
controlled, and do not invalidate existing tests - Software recovers well from failures
41Understandability
- The more information we have, the smarter we
will test - Design is well understood
- Dependencies between external, internal, and
shared components are well understood - Technical documentation is accessible, well
organized, specific and detailed, and accurate
42Bugs lurk in corners and congregate at
boundaries
43Types of errors
- What is a Testing error?
- Claiming behavior is erroneous when it is in fact
correct - fixing this type of error actually breaks the
product
44Errors in classification
- What is a Classification error ?
- Classifying the error into the wrong category
- Why is this bad ?
- This puts you on the wrong path for a solution
45Example Bug Report
- Screen locks up for 10 seconds after submit
button is pressed - Classification 1 Usability Error
- Solution may be to catch user events and present
an hour-glass icon - Classification 2 Performance error
- solution may be a modification to a sort
algorithm (or visa-versa)
46Isolation error
- Incorrectly isolating the erroneous modules
- Example consider a client server architecture.
An improperly formed client request results in an
improperly formed server response - The isolation determined (incorrectly) that the
server was at fault and was changed - Resulted in regression failure for other clients
47Resolve errors
- Modifications to remediate the failure are
themselves erroneous - Example Fixing one fault may introduce another
48What is the ideal test case?
- Run one test whose output is "Modify line n of
module i." - Run one test whose output is "Input Vector v
produces the wrong output" - Run one test whose output is "The program has a
bug" (Useless, we know this)
49More realistic test case
- One input vector and expected output vector
- A collection of these make of a Test Suite
- Typical (naïve) Test Case
- Type or select a few inputs and observe output
- Inputs not selected systematically
- Outputs not predicted in advance
50Test case definition
- A test case consists of
- an input vector
- a set of environmental conditions
- an expected output.
- A test suite is a set of test cases chosen to
meet some criteria (e.g. Regression) - A test set is any set of test cases
51Testing Software Intensive Systems
52VV
- Verification
- are we building the product right?
- Validation
- are we building the right product?
- is the customer satisfied?
- How do we do it?
- Inspect and Test
53What do we inspect and test?
- All work products!
- Scenarios
- Requirements
- Designs
- Code
- Documentation
54Defect Testing
55A Testing Test
- Problem
- A program reads three integer values from the
keyboard separated by spaces. The three values
are interpreted as representing the lengths of
the sides of a triangle. The program prints a
message that states whether the triangle is
scalene, isosceles or equilateral. - Write a set of test cases to adequately test this
program
56Static and Dynamic VV
Requirementsspecification
High-Leveldesign
Detaileddesign
Program
Prototype
57Techniques
- Static Techniques
- Inspection
- Analysis
- Formal verification
- Dynamic Techniques
- Testing
58SE-CMMPA 07 Verify Validate System
- Verification perform comprehensive evaluations
to ensure that all work products meet
requirements - Address all work products from user needs an
expectations through production and maintenance - Validation - meeting customer needs - continues
throughout product lifecycle
59VV Base Practices
- Establish plans for VV
- objectives, resources, facilities, special
equipment - come up with master test plan
- Define the work products to be tested
(requirements, design, code) and the methods
(reviews, inspections, tests) that will be used
to verify - Define verification methods
- test case input, expected results, criteria
- connect requirements to tests
60VV Base Practices...
- Define how to validate the system
- includes customer as user/operator
- test conditions
- test environment
- simulation conditions
- Perform VV and capture results
- inspection results test results exception
reports - Assess success
- compare results against expected results
- success or failure?
61Testing is...
- The process of executing a program with the
intent of finding defects - This definition implies that testing is a
destructive process - often going against the
grain of what software developers do, i.e..
construct and build software - A successful test run is NOT one in which no
errors are found
62Test Cases
- A successful test case finds an error
- An unsuccessful test case is one that causes the
program to produce the correct result - Analogy feeling ill, going to the doctor, paying
300 for a lab test only to be told that youre
OK!
63Testing demonstrates the presence not the absence
of faults
64Iterative Testing Process
User Testing
Component Testing
Integration Testing
65It is impossible to completely test a program
66Testing and Time
- Exhaustive testing is impossible for any program
with low to moderate complexity - Testing must focus on a subset of possible test
cases - Test cases should be systematically derived, not
random
67Testing Strategies
- Top Down testing
- use with top-down programming stubs required
difficult to generate output - Bottom Up testing
- requires driver programs often combined with
top-down testing - Stress testing
- test system overload often want system to
fail-soft rather than shut down - often finds unexpected combinations of events
68Test-Support Tools
- Scaffolding
- code created to help test the software
- Stubs
- a dummied-up low-level routine so it can be
called by a higher level routine
69Stubs Can Vary in Complexity
- Return, no action taken
- Test the data fed to it
- Print/echo input data
- Get return values from interactive input
- Return standard answer
- Burn up clock cycles
- Function as slow, fat version of ultimate routine
70Driver Programs
- Fake (testing) routine that calls other real
routines - Drivers can
- call with fixed set of inputs
- prompt for input and use it
- take arguments from command line
- read arguments from file
- main() can be a driver - then remove it with
preprocessor statements. Code is unaffected
71System Tests Should be Incremental
Modules
A
test 1test 2
B
72System Tests Should be Incremental
Modules
A
test 1test 2 test 3
B
73System Tests Should be Incremental
Modules
A
test 1test 2 test 3test 4
B
Not Big-Bang
74Approaches to Testing
- White Box testing
- based on the implementation - the structure of
the code also called structural testing - Black Box testing
- based on a view of the program as a function of
Input and Output also called functional testing - Interface Testing
- derived from program specification and knowledge
of interfaces
75White Box (Structural) Testing
- Testing based on the structure of the code
if x then j 2else k 5...
start with actual program code
76White Box (Structural) Testing
- Testing based on the structure of the code
Test data
Tests
if x then j 2else k 5...
Test output
77White Box TechniqueBasis Path Testing
- Objective-
- test every independent execution path through the
program - If every independent path has been executed then
every statement will be executed - All conditional statements are tested for both
true and false conditions - The starting point for path testing is the flow
graph
78Flow Graphs
if then else
79Flow Graphs
if then else
loop while
80Flow Graphs
if then else
loop while
case of
81How many paths thru this program?
- 1) j 2
- 2) k 5
- 3) read (a)
- 4) if a2
- 5) then j a
- 6) else j ak
- 7) a a 1
- 8) j j 1
- 9) print (j)
82How many paths thru this program?
1) j 2 2) k 5 3) read (a) 4) if a2 5)
then j a 6) else j ak 7) a a 1 8) j
j 1 9) print (j)
7,8,9
83How Many Independent Paths?
- An independent path introduces at least one new
statement or condition to the collection of
already existing independent paths - Cyclomatic Complexity (McCabe)
- For programs without GOTOs,
- Cyclomatic Complexity Number of decision nodes
1
also called predicate nodes
84The Number of Paths
- Cyclomatic Complexity gives an upper bound on the
number of tests that must be executed in order to
cover all statements - To test each path requires
- test data to trigger the path
- expected results to compare against
851) j 2 2) k 5 3) read (a) 4) if a2 5)
then j a 6) else j ak 7) a a 1 8) j
j 1 9) print (j)
7,8,9
86Test 1input 2 expected output 3
1) j 2 2) k 5 3) read (a) 4) if a2 5)
then j a 6) else j ak 7) a a 1 8) j
j 1 9) print (j)
7,8,9
87Test 1input 2 expected output 3
Test 2input 10 expected output 51
1) j 2 2) k 5 3) read (a) 4) if a2 5)
then j a 6) else j ak 7) a a 1 8) j
j 1 9) print (j)
7,8,9
88What Does Statement Coverage Tell You?
so?
- All statements have been executed at least once
89What Does Statement Coverage Tell You?
- All statements have been executed at least once
Coverage testing may lead to the false illusion
that the software has been comprehensively tested
90The Downside of Statement Coverage
- Path testing results in the execution of every
statement - BUT, not all possible combinations of paths thru
the program - There are an infinite number of possible path
combinations in programs with loops
91The Downside of Statement Coverage
- The number of paths is usually proportional to
program size making it useful only at the unit
test level
92Black Box Testing
93Forget the code details!
94Forget the code details!
Treat the program as a Black Box
In
Out
95Black Box Testing
- Aim is to test all functional requirements
- Complementary, not a replacement for White Box
Testing - Black box testing typically occurs later in the
test cycle than white box testing
96Defect Testing Strategy
Input Test Data
Locate inputs causingerroneous output
Output
Output indicating defects
97Black Box Techniques
- Equivalence partitioning
- Boundary value testing
98Equivalence Partitioning
- Data falls into categories
- Positive and Negative Numbers
- Strings with without blanks
- Programs often behave in a comparable way for all
values in a category -- also called an
equivalence class
99invalid input
valid input
System
100Choose test cases from partitions
invalid input
valid input
System
101Specification determines Equivalence Classes
- Program accepts 4 to 8 inputs
- Each is 5 digits greater than 10000
102Specification determines Equivalence Classes
- Program accepts 4 to 8 inputs
- Each is 5 digits greater than 10000
less than 4
4 thru 8
more than 8
103Specification determines Equivalence Classes
- Program accepts 4 to 8 inputs
- Each is 5 digits greater than 10000
104Specification determines Equivalence Classes
- Program accepts 4 to 8 inputs
- Each is 5 digits greater than 10000
105Specification determines Equivalence Classes
- Program accepts 4 to 8 inputs
- Each is 5 digits greater than 10000
106Boundary Value Analysis
- Complements equivalence partitioning
- Select test cases at the boundaries of a class
- Range Boundary a..b
- test just below a and just above b
- Input specifies 4 values
- test 3 and 5
- Output that is limited should be tested above and
below limits
107Other Testing Strategies
- Array testing
- Data flow testing
- GUI testing
- Real-time testing
- Documentation testing
108Arrays
- Test software with arrays of one value
- Use different arrays of different sizes in
different tests - Derive tests so that the first, last and middle
elements are tested
109Data Flow testing
- Based on the idea that data usage is at least as
error-prone as control flow - Boris Beizer claims that at least half of all
modern programs consist of data declarations and
initializations
110Data Can Exist in One of Three States
- Defined
- initialized, not used
- a 2
- Used
- x a b c
- z sin(a)
- Killed
- free (a)
- end of for loop or block where is was defined
111Entering Exiting
- Terms describing context of a routine before
doing something to a variable - Entered
- control flow enter the routine before variable is
acted upon - Exited
- control flow leaves routine immediately after
variable is acted upon
112Data Usage Patterns
- Normal
- define variable use one or more times perhaps
killed - Abnormal Patterns
- Defined-Defined
- Defined-Exited
- if local, why?
- Defined-Killed
- wasteful if not strange
113More Abnormal Patterns
- Entered-Killed
- Entered-Used
- should be defined before use
- Killed-Killed
- double kills are fatal for pointers
- Killed-Used
- why really are you using?
- Used-Defined
- whats its value?
114Define-Use Testing
- if (condition-1)
- x a
- else
- x b
- if (condition-2)
- y x 1
- else
- y x - 1
Path Testing Test1 condition-1
TRUE condition-2 TRUE Test2 condition-1
FALSE condition-2 FALSE WILL EXERCISE EVERY LINE
OF CODE BUT will NOT test the DEF-USE
combinations xa / y x-1 xb/ y x 1
115GUIs
- Are complex to test because of their event driven
character - Windows
- move, resized and scrolled
- regenerate when overwritten and then recalled
- menu bars change when window is active
- multiple window functionality available?
116GUI.. Menus
- Menu bars in context?
- Submenus - listed and working?
- Are names self explanatory?
- Is help context sensitive?
- Cursor changes with operations?
117Testing Documentation
- Great software with lousy documentation can kill
a product - Documentation testing should be part of every
test plan - Two phases
- review for clarity
- review for correctness
118Documentation Issues
- Focus on functional usage?
- Are descriptions of interaction sequences
accurate - Examples should be used
- Is it easy to find how to do something
- Is there trouble shooting section
- Easy to look up error codes
- TOC and index
119Real-Time Testing
- Needs white box and black box PLUS
- consideration of states, events, interrupts and
processes - Events will often have different effects
depending on state - Looking at event sequences can uncover problems
120Real-Time Issues
- Task Testing
- test each task independently
- Event testing
- test each separately then in context of state
diagrams - scenario sequences and random sequences
- Intertask testing
- Ada rendezvous
- message queuing buffer overflow
121Other Testing Terms
- Statistical testing
- running the program against expected usage
scenarios - Regression testing
- retesting the program after modification
- Defect testing
- trying to find defects (aka bugs)
- Debugging
- the process of discovering and removing defects
122Summary VV
- Verification
- Are we building the system right?
- Validation
- Are we building the right system?
- Testing is part of VV
- VV is more than testing...
- VV is plans, testing, reviews, methods,
standards, and measurement
123Testing Principles
- The necessary part of a test case is a definition
of the expected output or result - the eye often sees what it wants to see
- Programmers should avoid testing their own code
- Organizations should not test their own programs
- Thoroughly inspect the results of each test
124Testing Principles
- Test invalid as well as valid conditions
- The portability of errors in a section code is
proportional to the number of errors already
found there
125Testing Principles
- Tests should be traceable to customer
requirements - Tests should be planned before testing begins
- The Pareto principle applies - 80 of all errors
is in 20 of the code - Begin small, scale up
- Exhaustive testing is not possible
- The best testing is done by a 3rd party
126Guidelines
- Testing capabilities is more important than
testing components - users have a job to do tests should focus on
things that interfere with getting the job done,
not minor irritations - Testing old capabilities is more important then
testing new features - Testing typical situations is more important than
testing boundary conditions
127System Testing
128System Testing
- Testing the system as a whole to validate that it
meets its specification and the objectives of its
users
129Development testing
- Hardware and software components should be
tested - as they are developed
- as sub-systems are created.
- These testing activities include
- Unit testing.
- Module testing
- Sub-system testing
130Development testing
- These tests do not cover
- Interactions between components or sub-systems
where the interaction causes the system to behave
in an unexpected way - The emergent properties of the system
131System testing
- Testing the system as a whole instead of
individual system components - Integration testing
- As the system is integrated, it is tested by the
system developer for specification compliance - Stress testing
- The behavior of the system is tested under
conditions of load
132System testing
- Acceptance testing
- The system is tested by the customer to check if
it conforms to the terms of the development
contract - System testing reveals errors which were
undiscovered during testing at the component level
133System Test Flow
Requirements specification
System design
System specification
Detailed design
System Integration test plan
Sub-system Integration test plan
Acceptance test plan
Unit code and test
System Integration test
Sub-system Integration test
Acceptance test
Service
134Integration testing
- Concerned with testing the system as it is
integrated from its components - Integration testing is normally the most
expensive activity in the systems integration
process
135Integration testing
- Should focus on
- Interface testing where the interactions between
sub-systems and components are tested - Property testing where system properties such as
reliability, performance and usability are tested
136Integration Test Planning
- Integration testing is complex and time-consuming
and planning of the process is essential - The larger the system, the earlier this planning
must start and the more extensive it must be - Integration test planning may be the
responsibility of a separate IVV (verification
and validation) team - or a group which is separate from the development
team
137Test planning activities
- Identify possible system tests using the
requirements document - Prepare test cases and test scenarios to run
these system tests - Plan the development, if required, of tools such
as simulators to support system testing - Prepare, if necessary, operational profiles for
the system - Schedule the testing activities and estimate
testing costs
138Interface Testing
- Within a system there may be literally hundreds
of different interfaces of different types.
Testing these is a major problem. - Interface tests should not be concerned with the
internal operation of the sub-system although
they can highlight problems which were not
discovered when the sub-system was tested as an
independent entity.
139Two levels of interface testing
- Interface testing during development when the
developers test what they understand to be the
sub-system interface - Interface testing during integration where the
interface, as understood by the users of the
subsystem, is tested.
140Two levels of interface testing
- What developers understand as the system
interface and what users understand by this are
not always the same thing.
141Interface Testing
A
B
C
142Interface Problems
- Interface problems often arise because of poor
communications within the development team or
because of poor change management procedures - Typically, an interface definition is agreed
but, for good reasons, this has to be chanegd
during development
143Interface Problems
- To allow other parts of the system to cope with
this change, they must be informed of it - It is very common for changes to be made and for
potential users of the interface to be unaware of
these changes - problems arise which emerge during interface
testing
144What is an interface?
- An agreed mechanism for communication between
different parts of the system - System interface classes
- Hardware interfaces
- Involving communicating hardware units
- Hardware/software interfaces
- Involving the interaction between hardware and
software
145What is an interface?
- Software interfaces
- Involving communicating software components or
sub-systems - Human/computer interfaces
- Involving the interaction of people and the
system - Human interfaces
- Involving the interactions between people in the
process
146Hardware interfaces
- Physical-level interfaces
- Concerned with the physical connection of
different parts of the system e.g. plug/socket
compatibility, physical space utilization, wiring
correctness, etc. - Electrical-level interfaces
- Concerned with the electrical/electronic
compatibility of hardware units i.e. can a signal
produced by one unit be processed by another unit
147Hardware interfaces
- Protocol-level interfaces
- Concerned with the format of the signals
communicated between hardware units
148Software interfaces
- Parameter interfaces
- Software units communicate by setting pre-defined
parameters - Shared memory interfaces
- Software units communicate through a shared area
of memory - Software/hardware interfaces are usually of this
type
149Software interfaces
- Procedural interfaces
- Software units communicate by calling pre-defined
procedures - Message passing interfaces
- Software units communicate by passing messages to
each other
150Parameter Interfaces
Subsystem 2
Subsystem 1
151Shared Memory Interfaces
SS1
SS2
SS3
Shared memory area
152Procedural Interfaces
Subsystem 1
Subsystem 2
153Message Passing Interfaces
Subsystem 1
Subsystem 2
154Interface errors
- Interface misuse
- A calling component calls another component and
makes an error in its use of its interface e.g.
parameters in the wrong order - Interface misunderstanding
- A calling component embeds assumptions about the
behavior of the called component which are
incorrect
155Interface errors
- Timing errors
- The calling and called component operate at
different speeds and out-of-date information is
accessed
156Stress testing
- Exercises the system beyond its maximum design
load - The argument for stress testing is that system
failures are most likely to show themselves at
the extremes of the systems behavior - Tests failure behavior
- When a system is overloaded, it should degrade
gracefully rather than fail catastrophically
157Stress testing
- Particularly relevant to distributed systems
- As the load on the system increases, so too does
the network traffic. At some stage, the network
is likely to become swamped and no useful work
can be done
158Acceptance testing
- The process of demonstrating to the customer that
the system is acceptable - Based on real data drawn from customer sources.
The system must process this data as required by
the customer if it is to be acceptable
159Acceptance testing
- Generally carried out by customer and system
developer together - May be carried out before or after a system has
been installed
160Performance testing
- Concerned with checking that the system meets its
performance requirements - Number of transactions processed per second
- Response time to user interaction
- Time to complete specified operations
161Performance testing
- Generally requires some logging software to be
associated with the system to measure its
performance - May be carried out in conjunction with stress
testing using simulators developed for stress
testing
162Reliability testing
- The system is presented with a large number of
typical inputs and its response to these inputs
is observed - The reliability of the system is based on the
number of incorrect outputs which are generated
in response to correct inputs - The profile of the inputs (the operational
profile) must match the real input probabilities
if the reliability estimate is to be valid
163Security testing
- Security testing is concerned with checking that
the system and its data are protected from
accidental or malicious damage - Unlike other types of testing, this cannot really
be tested by planning system tests. The system
must be secure against unanticipated as well as
anticipated attacks
164Security testing
- Security testing may be carried out by inviting
people to try to penetrate the system through
security loopholes
165Some Costly and Famous Software Failures
166Mariner 1 Venus probe loses its way 1962
167Mariner 1
- A probe launched from Cape Canaveral was set to
go to Venus - After takeoff, the unmanned rocket carrying the
probe went off course, and NASA had to blow up
the rocket to avoid endangering lives on earth - NASA later attributed the error to a faulty line
of Fortran code
168Mariner 1
- ... a hyphen had been dropped from the guidance
program loaded aboard the computer, allowing the
flawed signals to command the rocket to veer left
and nose down - The vehicle cost more than 80 million, prompting
Arthur C. Clarke to refer to the mission as "the
most expensive hyphen in history."
169Therac 25 Radiation Machine
170Radiation machine kills four 1985 to 1987
- Faulty software in a Therac-25 radiation-treatment
machine made by Atomic Energy of Canada Limited
(AECL) resulted in several cancer patients
receiving lethal overdoses of radiation - Four patients died
171Radiation machine kills four 1985 to 1987
- A lesson to be learned from the Therac-25 story
is that focusing on particular software bugs is
not the way to make a safe system, - "The basic mistakes here involved poor software
engineering practices and building a machine that
relies on the software for safe operation."
172ATT long distance service fails
173ATT long distance service fails 1990
- Switching errors in ATT's call-handling
computers caused the company's long-distance
network to go down for nine hours, the worst of
several telephone outages in the history of the
system - The meltdown affected thousands of services and
was eventually traced to a single faulty line of
code
174Patriot missile
175Patriot missile misses 1991
- The U.S. Patriot missile's battery was designed
to head off Iraqi Scuds during the Gulf War - System also failed to track several incoming Scud
missiles, including one that killed 28 U.S.
soldiers in a barracks in Dhahran, Saudi Arabia
176Patriot missile misses 1991
- The problem stemmed from a software error that
put the tracking system off by 0.34 of a second - System was originally supposed to be operated for
only 14 hours at a time - In the Dhahran attack, the missile battery had
been on for 100 hours - errors in the system's clock accumulated to the
point that the tracking system no longer
functioned
177Pentium chip
178Pentium chip fails math test 1994
- Pentium chip gave incorrect answers to certain
complex equations - bug occurred rarely and affected only a tiny
percentage of Intel's customers - Intel offered to replace the affected chips,
which cost the company 450 million - Intel then started publishing a list of known
"errata," or bugs, for all of its chips
179New Denver airport
180New Denver airport misses its opening 1995
- The Denver International Airport was intended to
be a state-of-the-art airport, with a complex,
computerized baggage-handling system and 5,300
miles of fiber-optic cabling - Bugs in the baggage system caused suitcases to be
chewed up and drove automated baggage carts into
walls
181New Denver airport misses its opening 1995
- The airport eventually opened 16 months late,
3.2 billion over budget, and with a mainly
manual baggage system
182The millennium bug 2000
- No need to discuss this !!
183Ariane 5 Rocket
184Ariane 5
- The failure of the Ariane 501 was caused by the
complete loss of guidance and attitude
information 37 seconds after start of the main
engine ignition sequence (30 seconds after lift-
off) - This loss of information was due to specification
and design errors in the software of the inertial
reference system
185Ariane 5
- The extensive reviews and tests carried out
during the Ariane 5 Development Programme did not
include adequate analysis and testing of the
inertial reference system or of the complete
flight control system, which could have detected
the potential failure
186More on Testing
From Beatty ESC 2002
187Agenda
- Introduction
- Types of software errors
- Finding errors methods and tools
- Embedded systems and RT issues
- Risk management and process
188Introduction
- Testing is expensive
- Testing progress can be hard to predict
- Embedded systems have different needs
- Desire for best practices
189Method
- Know what you are looking for
- Learn how to effectively locate problems
- Plan to succeed manage risk
- Customize and optimize the process
190Entomology
- What are we looking for ?
- How are bugs introduced?
- What are their consequences?
191Entomology Bug Frequency
- Rare
- Less common
- More common
- Common
192Entomology Bug severity
- Non functional doesnt affect object code
- Low correct problem when convenient
- High correct as soon as possible
- Critical change MUST be made
- Safety related or legal issue
- Domain Specific !
193Entomology - Sources
- Non-implementation error sources
- Specifications
- Design
- Hardware
- Compiler errors
- Frequency common 45 to 65
- Severity Non-functional to critical
194Entomology - Sources
- Poor specifications and designs are often
- Missing
- Ambiguous
- Wrong
- Needlessly complex
- Contradictory
Testing can fix these problems !
195Entomology - Sources
- Implementation error sources
- Algorithmic/processing bugs
- Data bugs
- Real-time bugs
- System bugs
- Other bugs
Bugs may fit in more than one category !
196Entomology Algorithm Bugs
- Parameter passing
- Common only in complex invocations
- Severity varies
- Return codes
- Common only in complex functions or libraries
- Reentrance problem
- Less common
- Critical
197Entomology Algorithm Bugs
- Incorrect control flow
- Common
- Severity varies
- Logic/math/processing error
- Common
- High
- Off by 1
- Common
- Varies, but typically high
198Example of logic error
If (( this AND that ) OR ( that AND other ) AND
NOT ( this AND other ) AND NOT ( other OR NOT
another ))
Boolean operations and mathematical calculations
can be easily misunderstood In complicated
algorithms!
199Example of off by 1
for ( x 0, x lt 10 x)
This will execute 11 times, not 10!
for ( x array_min x lt array_max x)
If the intention is to set x to array_max on the
last pass through the loop, then this is in error!
Be careful when switching between 1
based language (Pascal, Fortran) to zero based (C)
200Entomology Algorithm bugs
- Math underflow/overflow
- Common with integer or fixed point math
- High severity
- Be careful when switching between floating point
and fixed point processors
201Entomology Data bugs
- Improper variable initialization
- Less common
- Varies typically low
- Variable scope error
- Less common
- Low to high
202Example - Uninitialized data
int some_function ( int some_param ) int
j if (some_param gt 0) for ( j0 jlt3
j) / iterate through some process
/ else if (some_param lt
-10) some_param j / j is
uninitialized / return some_param
return 0
203Entomology Data bugs
- Data synchronization error
- Less common
- Varies typically high
204Example synchronized data
struct state / an interrupt will trigger
/ GEAR_TYPE gear / sending snapshot in a
message / U16 speed U16 speed_limit U8
last_error_code snapshot snapshot.speed
new_speed / somewhere in code
/ snapshot.gear new gear / somewhere
else / snapshot.speed_limit speed_limit_tb
gear
Interrupt splitting these two would be bad
205Entomology Data bugs
- Improper data usage
- Common
- Varies
- Incorrect flag usage
- Common when hard-coded constants used
- varies
206Example mixed math error
unsigned int a 5 int b -10 / somewhere
in code / if ( a b gt 0 )
ab is not evaluated as 5 ! the signed int b is
converted to an unsigned int
207Entomology Data bugs
- Data/range overflow/underflow
- Common in asm and 16 bit micro
- Low to critical
- Signed/unsigned data error
- Common in asm and fixed point math
- High to critical
- Incorrect conversion/type cast/scaling
- Common in complex programs
- Low to critical
208Entomology Data bugs
- Pointer error
- Common
- High to critical
- Indexing problem
- Common
- High to critical
209Entomology Real-time bugs
- Task synchronization
- Waiting, sequencing, scheduling, race conditions,
priority inversion - Less common
- Varies
- Interrupt handling
- Unexpected interrupts
- Improper return from interrupt
- Rare
- critical
210Entomology Real-time bugs
- Interrupt suppression
- Critical sections
- Corruption of shared data
- Interrupt latency
- Less common
- critical
211Entomology System bugs
- Stack overflow/underflow
- Pushing, pulling and nesting
- More common in asm and complex designs
- Critical
- Resource sharing problem
- Less common
- High to critical
- Mars pathfinder
212Entomology System bugs
- Resource mapping
- Variable maps, register banks, development maps
- Less common
- Critical
- Instrumentation problem
- Less common
- low
213Entomology System bugs
- Version control error
- Common in complex or mismanaged projects
- High to critical
214Entomology other bugs
- Syntax/typing
- if (ptrNULL) Cutpaste errors
- More common
- Varies
- Interface
- Common
- High to critical
- Missing functionality
- Common
- high
215Entomology other bugs
- Peripheral register initialization
- Less common
- Critical
- Watchdog servicing
- Less common
- Critical
- Memory allocation/de-allocation
- Common when using malloc(), free()
- Low to critical
216Entomology Review
- What are you looking for ?
- How are bugs being introduced ?
- What are their consequences ?
- Form your own target list!
217Finding the hidden errors
- All methods use these basic techniques
- Review checking
- Tests demonstrating
- Analysis proving
These are all referred to as testing !
218Testing
- Organized process of identifying variances
between actual and specified results - Goal zero significant defects
219Testing axioms
- All software has bugs
- Programs cannot be exhaustively tested
- Cannot prove the absence of all errors
- Complex systems often behave counter-intuitively
- Software systems are often brittle
220Finding spec/design problems
- Reviews / Inspections / Walkthroughs
- CASE tools
- Simulation
- Prototypes
Still need consistently effective methods !
221Testing Spec/Design Reviews
- Can be formal or informal
- Completeness
- Consistency
- Feasibility
- Testability
222Testing Evaluating methods
- Relative costs
- None
- Low
- Moderate
- High
- General effectiveness
- Low
- Moderate
- High
- Very high
223Testing Code reviews
- Individual review
- Effectiveness high
- Cost Time low, material - none
- Group inspections
- Effectiveness very high
- Cost Time moderate, material - none
224Testing Code reviews
- Strengths
- Early detection of errors
- Logic problems
- Math errors
- Non-testable requirement or paths
- Weaknesses
- Individual preparation and experience
- Focus on details, not big picture
- Timing and system issues
225Step by step execution
- Exercise every line of code or every branch
condition - Look for errors
- Use simulator, ICE, logic analyzer
- Effectiveness moderate dependent on tester
- Cost time is high, material is low or moderate
226Functional (Black Box)
- Exercise inputs and examine outputs
- Test procedures describe expected behavior
- Subsystems tested and integrated
- Effectiveness is moderate
- Cost time is moderate, material varies
Tip where functional testing finds problems look
deeper in that area !
227Functional (Black Box)
- Strengths
- Requirements problems
- Interfaces
- Performance issues
- Most critical/most used features
- Weaknesses
- Poor coverage
- Timing and other problems masked