Software Testing: " Testing Is The Process of Executing A Program With The Intent of Finding Errors."
Software Testing: " Testing Is The Process of Executing A Program With The Intent of Finding Errors."
““ Testing
Testing isis the
the process
process of
of
executing
executing aa program
program withwith the
the
intent
intent of
of finding
finding errors.”
errors.”
Glen
GlenMyers
Myers
1
Limits of software testing
• Testing can only prove the presence of bugs - never their absence
WHY???
2
Exhaustive testing
3
ThePeculiarity of
Testing
• Testing is the process of executing a program with
the intent of finding an error
• A good test case has a high probability of finding an
as-yet undiscovered error
• A successful test is one that uncovers an as-yet
undiscovered error
4
Who tests the software
better??
6
Testability = developing a
program be tested easily
• 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
7
Test case design
9
• Depending on the type of data input, we can identify three levels of
program correctness possible, probable, and absolute correctness
10
levels of program correctness
11
Possible correctness
Obtaining correct output for some arbitrary input (single set).
If the outcome is wrong, the program cannot possibly be correct.
For example a multiply program: for input 2 and 3, if result is 6; is
possibly correct.
Probable correctness
Obtaining correct output for a number of carefully selected inputs.
If all potential problematic areas are checked in this way, the program
is probably correct.
Try several values, including the obvious “problem” values such as
zero, largest negative, 1, -1 and so on.
Absolute correctness
can be demonstrated only by a test that involves every possible
combination of inputs.
Requires huge amount of time; it is therefore not practical {However
for some programs we can prove correctness mathematically}.
Imagine the same above test for a 32 bit machine (how many
combinations are possible? (Hundreds of Millions).
12
Approaches to tests
requirements
output
input
events
13
White box testing
CANNOT BE
EXHAUSTIVE!!!
14
Approaches to White Box Testing
15
Why bother with white box testing?
17
Exhaustive testing
Selective Testing
18
Selective testing
19
Basis set
20
Basis path testing
• Name
• Number
• Values for the inputs
• Expected outputs
• Short description (if needed)
23
Basis path testing notes
24
Example
Program
void
void f()
f() {{
if(count
if(count >> 10){
10){
fixed_count
fixed_count == fixed_count
fixed_count ++ count;
count;
done
done == 1;
1;
}} else
else if(count
if(count >5){
>5){
fixed_count
fixed_count --;
--;
}} else
else {{
fixed_count
fixed_count == count
count ** 4;
4;
}}
}}
25
Flow Graph
void f()
11
88 fixed_count --;
return;
26
Derivation of the test cases
• V(P) = 3 (2 conditions + 1)
• Independent paths: 11
(a) 1, 2, 3, 8
(b) 1, 2, 4, 5, 7, 8 22
(c) 1, 2, 4, 6, 7, 8 44 33
• Test cases: 55 66
(a) count 13 77
(b) count 8 88
(c) count 2
27
Example
PROCEDURE average
INTERFACE RETURNS average, total.input, total.valid;
INTERFACE ACCEPTS value, minimum, maximum;
TYPE value[1:100] IS SCALAR ARRAY;
TYPE average, total.input, total.valid;
minimum, maximum, sum IS SCALAR;
TYPE i IS INTEGER;
i = 1;
total.input = total.valid = 0;
1 sum = 0; 2
DO WHILE value[i] <> -999 AND total.input < 100
increment total.input by 1; 3
4
IF value[i] >= minimum AND value[1] <= maximum
6
5 THEN increment total.valid by 1;
sum = sum + value[i]
7 ELSE skip
8 ENDIF
increment i by 1;
9 ENDDO
IF total.valid >10
0
11
12 THEN average = sum/total.valid;
ELSE average = -999;
13 ENDIF
END average
28
…Example
1
3
10
4
12 11
13 5
Determine the:
6
1. Cyclomatic complexity
7
8
2. Independent paths
9 29
Condition Testing
• Branch testing: for each condition C, the true and the false
branches resulting from it and every simple condition in C need to be
executed at least once
• Domain testing: it uses information on the domain;
• given a relational condition in the program such as a<b I have to test it with
with values of a and b a<b, a=b, a>b and a and be VERY close
• given a boolean condition with n variables, I have to test it for each
combination of the values (that is 2n cases)
• There are other approaches, such as Branch and Relational operator
testing
31
Data Flow Testing
• Data flow testing identifies paths in the program that go from the
assignment of a value to a variable to the use of such variable, to
make sure that the var is properly used.
• The DU (Definition - Usage) testing strategy requires that each DU
chain is covered at least once
32
Data Flow Testing
simple loop
36
Nested loops
37
Concatenated loops
int k;
for (k=0;k<10;k++)
k=0;k<10;k++
{
w();
if p(m) break;
}
for (;k<10;k++)
;k<10;k++ {
r();
}
38
How do we select the strategy?
• The requirements of reliability of the system
• The resources available
• The kind of programs
• functional languages do not have loops…
• The tools available to support the testing process
39
Theoretical Foundation of Testing
• Mathematical model: Let P be a program, and let D and R denote its input (Data) and output
(Result) ranges. That is, D is a set of all data that can correctly be supplied to P, and the results of P’s execution,
if any, are elements of R.
TEST EXAMPLE : Statement Coverage Criteria: We can use above model to define test as: Select a test set T such
that, by executing P for each d (subset of D) in T, each elementary statement of P is executed at least once.
If x > y Then
max = x;
else
max = x;
endif;
The test case set [x =3, y= 2; x= 2, y= 3] is able to detect the error. Whereas
Test case set [x=3, y = 2; x =4, y = 3, x = 5, y = 1] is not, although it contains
more test cases.
40
Black box testing
requirements
output
input
events
41
Categories of errors in black box
testing
• incorrect or missing functions
• interface errors
• errors in data structures or external database access
• performance errors
• initialization and termination errors
42
Techniques for black box
testing
• Graph-Based Testing Methods
• Equivalence Partitioning
• Boundary Value Analysis
• Comparison Testing
43
Graph-Based Testing
Pressman, p. 472
44
Equivalence Partitioning.. (to
design test cases)
• Input data and output results often fall into
different classes where all members of a class are
related
45
Equivalence Partitioning.. (to
design test cases)
46
Defining Equivalence Classes
• Input condition is a range: one valid and two invalid classes are
defined
• Input condition requires specific value: one valid and two
invalid classes are defined
• Input condition is boolean: one valid and one invalid class are
defined
47
Defining Equivalence Classes
48
Defining Equivalence Classes
49
Boundary value testing
• Range a..b
• test cases: a, b, just above a, just below b
• Number of values:
• test cases: max, min, just below min, just above max
• Output bounds should be checked
• Boundaries of externally visible data structures shall be checked (e.g.
arrays)
50
Error-Guessing
51
Testing Phase
52
Define Testing Strategy
• Select the testing technique that will be used for testing like Stress
Testing, Security Tests, performance Tests, Load Tests etc)
• Also consider the resources that will be employed for testing the
project. Resources are Hardware, Software, and Human.
53
Example: Windows
Calculator
R-001:
The users should be able to add two numbers and view their result on the display.
2. The actor input the first number by clicking on the 3. The digit is displayed on the screen.
keypad or using keyboard.
4. The actor clicks or presses the “+” key.
5.The actor then adds the second number as (2). 6. The pressed digit is displayed on the screen.
7. The actor clicks the “=” key. 8. The sum of the two digits is displayed on the screen.
54
Test Case
55
Bug Report
56
Debugging
57
Bugs and Debugging
The bug is the name of an error - anything goes wrong with our
program, when it runs.
61
Testing Strategies
There are basically 3 levels of testing unit, integration, and system
testing. But the complete testing include the fourth one (i.e.)
acceptance testing.
These different levels of testing attempt to detect different types of
faults.
The relation of faults introduced in different phases and different levels
of testing, are shown as:
refers
Client needs Acceptance testing.
refers
Requirements System Testing
refers
Design Integration testing
refers
Code Unit Testing
62
Unit Testing
Unit under
Effectiveness?
test • Partitioning
• Code coverage
• Module interface
• Ensure that information flows properly into and out of the module
• Local data structures
• Ensure that data stored temporarily maintains its integrity during all steps in
an algorithm execution
• Boundary conditions
• Ensure that the module operates properly at boundary values established to
limit or restrict processing
• Independent paths (basis paths)
• Paths are exercised to ensure that all statements in a module have been
executed at least once
• Error handling paths
• Ensure that the algorithms respond correctly to specific error conditions
64
Common Computational Errors in
Execution Paths
65
Drivers and Stubs for
Unit Testing
• Driver
• A simple main program that accepts test case data, passes such data to the
component being tested, and prints the returned results
• Stubs
• Serve to replace modules that are subordinate to (called by) the component
to be tested
• It uses the module’s exact interface, may do minimal data manipulation,
provides verification of entry, and returns control to the module
undergoing testing
• Drivers and stubs both represent overhead
• Both must be written but don’t constitute part of the installed software
product
66
Integration Testing
• Objectives:
• To expose problems arising from the combination
• To quickly obtain a working solution from components.
• Problem areas
• Internal: between components
• Invocation: call/message passing/…
• Parameters: type, number, order, value
• Invocation return: identity (who?), type, sequence
• External:
• Interrupts (wrong handler?)
• I/O timing
• Interaction
67
Regression Testing
68
Why Regression Testing?
69
When can we perform Regression
Testing?
• New functionality is added to the application: This happens when new features or
modules are created in an app or a website. The regression is performed to see if the
feature is working properly.
• In case of change requirement: When any significant change occurs in the system,
regression testing is used. This test is done to check if these shifts have affected other
features.
• After a defect is fixed: The developers perform regression after fixing a bug issue in any
functionality. This is done to determine if the changes made while fixing the issue have
affected other related features.
• Once the performance issue is fixed: After fixing any performance issues, regression
testing is done to see if it has affected other functionalities.
• While integrating with a new external system: Regression testing is required whenever
the product integrates with a new external system.
70
How to do Regression Testing in Software Testing
Retest All
This is one of the methods for Regression Testing, specifically employing a regression
testing suite, in which all the tests in the existing test bucket or suite should be re-
executed. This is very expensive as it requires huge time and resources.
Regression Test Selection
Regression Test Selection is a technique in which some selected test cases from test suite
are executed to test whether the modified code affects the software application or not.
Test cases are categorized into two parts, reusable test cases which can be used in further
regression cycles and obsolete test cases which can not be used in succeeding cycles.
Prioritization of Test Cases
Prioritize the test cases depending on business impact, critical & frequently used
functionalities. Selection of test cases based on priority will greatly reduce the regression
test suite.
71
System Testing
74
Testing in the V-Model
Requirements Acceptance
Customer test
Developer
Architectural System test
s
t e st
Design
Wri
Run
Integration test
te te
Detailed
Design Functional
st s
Module Structural
Unit test
implementation
75
Some Terminology
• Failure
• A failure is said to occur whenever the external behavior does not conform to system
spec.
• Error
• An error is a state of the system which, in the absence of any corrective action, could
lead to a failure.
• Fault
• An adjudged cause of an error.
76
Some Terminology
Program state
Error
Observed
Failure
77
Fault, Error , Failure
Fault: A fault is the underlying defect in a system. It may be a bug in the code or a hardware defect that could lead to
incorrect behavior.
Example: A developer writes an incorrect line of code due to a logic mistake, such as using > instead of >= in a condition.
Error: An error is the manifestation of the fault during execution. When the system is running, and this faulty code is executed, it leads to incorrect
system state.
Example: When the temperature is exactly 30°C, the cooling system is not activated because the code uses > instead of >=.
This is an error in the system's internal state.
Failure: A failure occurs when the system does not deliver the expected service to the user due to the error. It is the visible incorrect behavior
of the system from the user's perspective.
Example: The user notices that when the temperature hits 30°C, the cooling system does not activate, resulting in a failure of the system to
maintain the desired temperature.
In this case:
•Fault: The wrong condition > instead of >=.
•Error: At 30°C, the system enters an incorrect state where the cooling system is not triggered.
•Failure: The cooling system does not work as expected, leading to overheating.
78
Testing Activities
Subsystem Requirements
Unit System
Code Test Analysis
Design Document
Tested Document User
Subsystem
Subsystem Manual
Unit
Code Test
Tested Integration Functional
Subsystem
Test Test
Integrated Functioning
Subsystems System
Tested Subsystem
Subsystem Unit
Code Test
All
Alltests
testsby
bydeveloper
developer
79
Testing Activities continued
Client’s
Global Understanding User
Requirements of Requirements Environment
Usable
Tests
Testsby
byclient
client System
Tests
Testsby
bydeveloper
developer
User’s understanding
System in
Use
Tests
Tests(?)
(?) by
byuser
user
80
Comparison of White & Black-box
Testing
• White-box Testing: • Both types of testing are needed
• Potentially infinite number of paths • White-box testing and black box
have to be tested testing are the extreme ends of a
• White-box testing often tests what testing continuum.
is done, instead of what should be
done • Any choice of test case lies in
• Cannot detect missing use cases between and depends on the
following:
• Black-box Testing:
• Number of possible logical paths
• Potential combinatorical explosion
of test cases (valid & invalid data) • Nature of input data
• Often not clear whether the • Amount of computation
selected test cases uncover a • Complexity of algorithms and data
particular error structures
• Does not discover extraneous use
cases ("features")
81
Software Quality
assurance (SQA)
Lecture 4
82
Outline
Introduction
Software Life Cycle
Quality Control
Infrastructure
Management
Standards
Conclusion & Summary
83
Management
Project Progress Control
Quality Metrics
Cost of Quality
Discussion & Summary
84
1. Project Progress Control
Overview:
The components of project progress control
85
Components of Project Progress
Control
Control of risk management activities
Project schedule control
Project resource control
Project budget control
86
Control of Risk Management
Activities
87
Project Schedule Control
Compliance of the project with its approved and
contracted timetables
Control is based mainly on milestone reports
which are set (in part) to facilitate identification of
delays and other periodic reports
Milestones set in contracts, especially dates for
delivery, receive special emphasis
Focus on critical delays (which may effect final
completion of the project)
Management interventions:
Allocation of additional resources
Renegotiating the schedule with the customer
88
Project Resource Control
Main control items:
Human resources
Special development and testing equipment (real-time
systems; firmware)
Resource control primarily focuses on professional human
resources but applies to other assets too.
Real-time software and firmware projects require strict resource
monitoring through periodic reports.
Small deviations in resource use can mask larger cumulative
impacts if project progress is delayed.
Internal allocation reviews help detect budget strains, such as
imbalanced senior vs. junior analyst hours.
Early detection of deviations allows for resource reallocation, team
reorganization, or project plan revisions.
89
Project Budget Control
Main budget items:
Human resources
Development and testing facilities
Purchase of COTS software
Purchase of hardware
Payments to subcontractors
Control is based on the milestone reports and other
periodic reports
Usually budget control has the highest priority, but
only the combination of all control aspects ensure the
required
90
Progress control of internal
projects and external participants
Problem: In practice project control provides only a
limited view of the progress of internal software
development and an even more limited view on the
progress made by external project participants
Internal projects have by definition no external
customer and therefore tend to occupy a lower place
among management's priorities. Therefore, the full
range of project progress control should be employed
More significant efforts are required in order to achieve
acceptable levels of control for an external project
participant due to the more complex communication
and coordination
91
Implementation of project progress
control regimes
Procedures:
Allocation of responsibilities for
Person or management for progress control
Frequency of reporting from each of the unit levels and
administrative level
Situation requiring the project leader to report immediately
to management
Situation requiring lower management to report immediately
to upper management
Management audits of project progress which deals mainly with
(1) How well progress reports are transmitted by project
leaders and by lower- to upper-level management
(2) Specific management control activities to be initiated
92
Implementation of project progress
control regimes
Remarks:
Project progress control may be conducted on
several managerial levels in large software
development organizations coordination becomes
essential
Project leaders base there progress reports on
information gathered from team leaders
93
Computerized Project Progress
Control
Required for non trivial projects
Automation can reduce costs considerably
94
Computerized Control of risk
management
Listsof software risk items by category and their
planned solution dates
Listsof exceptions of software risk items –
overrun solution dates
95
Control
97
Computerized Project Budget
Control
Project budget plans
for activity and software module
for teams and development units
for designated time periods, etc.
Project budget utilization reports — as specified
above
Project budget utilization deviations – by period or
accumulated – as specified above
Updated budget plans generated according to
progress reports ports and correction measures
98
2. Quality Metrics
“You can’t control what you can’t measure”
[DeMarco1982]
Overview:
Objectives of quality measurement
Classification of software quality metrics
Process metrics
Product metrics
Implementation of software quality metrics
Limitations of software metrics
The function point method
99
Definition
IEEE definition of software quality metrics:
A quantitative measure of the degree to
which an item possesses a given quality
attribute.
A function whose inputs are software data
and whose output is a single numerical value
that can be interpreted as the degree to
which the software possesses a given quality
attribute.
100
Objectives
Facilitate management control, planning and
managerial intervention. Based on:
Deviations of actual from planned performance.
Deviations of actual timetable and budget
performance from planned.
Identify situations for development or
maintenance process improvement (preventive
or corrective actions). Based on:
Accumulation of metrics information regarding the
performance of teams, units, etc.
101
Requirements
General requirements
Relevant
Valid
Reliable
Comprehensive
Mutually exclusive
Operative requirements
Easy and simple
Does not require independent data collection
Immune to biased interventions by interested parties
102
Classifications
Classification by phases of software system:
Process metrics: metrics related to the software
development process
Maintenance metrics: metrics related to software
maintenance (product metrics in [Galin2004])
Product metrics: metrics related to software artifacts
103
Software Size/Volume Measures
104
Error Counted Measures
Calculation of NCE Calculation of WCE
low severity 42 1 42
medium severity 17 3 51
high severity 11 9 99
Number of code errors (NCE) vs. weighted number of code errors (WCE)
105
Process Metrics Categories
Software process quality metrics
Error density metrics
Error severity metrics
Software process timetable metrics
Software process error removal
effectiveness metrics
Software process productivity metrics
106
Error Density Metrics
Code Name Calculation formula
NCE = The number of code errors detected by code inspections and testing.
NDE = total number of development (design and code) errors) detected in the development process.
WCE = weighted total code errors detected by code inspections and testing.
WDE = total weighted development (design and code) errors detected in development process.
107
Error Severity Metrics
Code Name Calculation formula
ASCE Average Severity of Code WCE
ASCE = -----------
Errors NCE
DED Average Severity of WDE
ASDE = -----------
Development Errors NDE
NCE = The number of code errors detected by code inspections and testing.
NDE = total number of development (design and code) errors) detected in the
development process.
WCE = weighted total code errors detected by code inspections and testing.
WDE = total weighted development (design and code) errors detected in
development process.
108
Software Process Timetable Metrics
Code Name Calculation formula
109
Error Removal Effectiveness Metrics
Code Name Calculation formula
NDE = total number of development (design and code) errors) detected in the
development process.
WCE = weighted total code errors detected by code inspections and testing.
WDE = total weighted development (design and code) errors detected in
development process.
NYF = number software failures detected during a year of maintenance service.
WYF = weighted number of software failures detected during a year of maintenance
service.
110
Process Productivity Metrics
Code Name Calculation formula
DevH = Total working hours invested in the development of the software system.
ReKLOC = Number of thousands of reused lines of code.
ReDoc = Number of reused pages of documentation.
NDoc = Number of pages of documentation.
111
Maintenance Metrics Categories (1/2)
Help desk service (HD):
software support by instructing customers regarding the
method of application of the software and solution for
customer implementation problems (depends to a great
extent on “user friendliness”)
Related metrics:
HD quality metrics:
HD calls density metrics - measured by the number of calls.
HD calls severity metrics - the severity of the HD issues raised.
HD success metrics – the level of success in responding to HD calls.
HD productivity metrics.
HD effectiveness metrics.
112
Maintenance Metrics Categories (2/2)
Corrective maintenance:
Correction of software failures identified by
customers/users or detected by the customer service team prior to
their discovery be the customer (directly related to the software
development quality)
Related metrics:
Corrective maintenance quality metrics.
Software system failures density metrics
Software system failures severity metrics
Failures of maintenance services metrics
Software system availability metrics
Corrective maintenance productivity metrics
Corrective maintenance effectiveness metrics
113
HD Calls Density Metrics
Code Name Calculation formula
114
Severity of HD Calls Metrics and HD Success
Metrics
Code Name Calculation formula
NHYNOT = Number of yearly HD calls completed on time during one year of service.
NHYC = the number of HD calls during a year of service.
115
HD Productivity and Effectiveness Metrics
Code Name Calculation formula
HD Productivity HDYH
HDP HDP= --------------
KLNC
Function Point HD HDYH
FHDP FHDP = ----------
Productivity NMFP
HD effectiveness HDYH
HDE HDE = --------------
NHYC
HDYH = Total yearly working hours invested in HD servicing of the software system.
KLMC = Thousands of lines of maintained software code.
NMFP = number of function points to be maintained.
NHYC = the number of HD calls during a year of service.
116
Failures Density Metrics
Code Name Calculation formula
NYF
SSFD Software System Failure SSFD = --------------
Density KLMC
WYF
WSSFD Weighted Software WFFFD = ---------
System Failure Density KLMC
WYF
WSSFF Weighted Software WSSFF = ----------
System Failures per NMFP
Function point
117
Failures Density Metrics
Code Name Calculation formula
118
Availability Metrics
Code Name Calculation formula
NYSerH - NYFH
FA Full Availability FA = -----------------------
NYSerH
NYSerH - NYVitFH
VitA Vital Availability VitA = -----------------------------
NYSerH
NYTFH
TUA Total Unavailability TUA = ------------
NYSerH
NYSerH = Number of hours software system is in service during one year.
NYFH = Number of hours where at least one function is unavailable (failed) during one year,
including total failure of the software system.
NYVitFH = Number of hours when at least one vital function is unavailable (failed) during
one year, including total failure of the software system.
NYTFH = Number of hours of total failure (all system functions failed) during one year.
119
Software Corrective Maintenance
Productivity and Effectiveness Metrics
Code Name Calculation formula
CMaiYH = Total yearly working hours invested in the corrective maintenance of the software
system.
NYF = number of software failures detected during a year of maintenance service.
NMFP = number of function points designated for the maintained software.
KLMC = Thousands of lines of maintained software code.
120
Product Metrics Categories
Product metrics can also be used for general
predictions or to identify anomalous components.
Classes of product metric
Dynamic metrics which are collected by
measurements made of a program in execution;
Static metrics which are collected by measurements
made of the system representations;
Dynamic metrics help assess efficiency and
reliability; static metrics help assess complexity,
understandability and maintainability.
121
Static Metrics
Static metrics have an indirect relationship with
quality attributes (see also static analysis)
122
Software Product Metrics
Software metric Description
Fan in/Fan-out Fan-in is a measure of the number of functions or methods that call some other function
or method (say X). Fan-out is the number of functions that are called by function X. A
high value for fan-in means that X i s tightly coupled to the rest of the design and
changes to X will have extensive knock-on effects. A high value for fan-out suggests
that the overall complexity of X m ay be high because of the complexity of the control
logic needed to coordinate the called components.
Length of code This is a measure of the size of a p rogram. Generally, the larger the size of the code of a
component, the more complex and error-prone that component is likely to be. Length of
code has been shown to be one of the most reliable metrics for predicting error-
proneness in components.
Cyclomatic complexity This is a m easure of the control complexity of a p rogram. This control complexity may
be related to program understandability. I discuss how to compute cyclomatic
complexity in Chapter 22.
Length of identifiers This is a measure of the average length of distinct identifiers in a p rogram. The longer
the identifiers, the more likely they are to be m eaningful and hence the more
understandable the program.
Depth of conditional This is a measure of the depth of nesting of if-statements in a program. Deeply nested if
nesting statements are hard to understand and are potentially error-prone.
Fog index This is a measure of the average length of words and sentences in documents. The higher
the value for the Fog index, the more difficult the document is to understand.
123
Object-oriented Metrics
Object-oriented
metric Description
Depth of inheritance This represents the number of discrete levels in the inheritance tree where sub-
tree classes inherit attributes and operations (methods) from super-classes. The
deeper the inheritance tree, the more complex the design. Many different object
classes may have to be understood to understand the object classes at the leaves
of the tree.
Method fan-in/fan- This is directly related to fan-in and fan-out as described above and means
out essentially the same thing. However, it may be appropriate to make a
distinction between calls from other methods within the object and calls from
external methods.
This is the number of methods that are included in a class weighted by the
Weighted methods
complexity of each method. Therefore, a simple method may have a complexity
per class of 1 and a large and complex method a much higher value. The larger the value
for this metric, the more complex the object class. Complex objects are more
likely to be more difficult to understand. They may not be logically cohesive so
cannot be reused effectively as super-classes in an inheritance tree.
Number of This is the number of operations in a super-class that are over-ridden in a sub-
overriding class. A high value for this metric indicates that the super-class used may not be
operations an appropriate parent for the sub-class.
124
The Measurement Process
A software measurement process may be part of a
quality control process.
(1) Define software quality metrics
(2) Select components to be assessed
(3) Data collection
(4) Identify anomalous measurement
(5) Analyse anomalous measurement
Data collected during this process should be
maintained as an organisational resource.
Once a measurement database has been
established, comparisons across projects become
possible.
125
(1) Defining
Software
Quality
Metrics
126
(3) Data Collection
A metrics programme should be based on a
set of product and process data.
Data should be collected immediately (not
in retrospect) and, if possible,
automatically.
Three types of automatic data collection
Static product analysis;
Dynamic product analysis;
Process data collation.
127
Data Accuracy
Don’t collect unnecessary data
The questions to be answered should be
decided in advance and the required data
identified.
Tell people why the data is being collected.
It should not be part of personnel evaluation.
Don’t rely on memory
Collect data when it is generated not after a
project has finished.
128
(5) Measurement Analysis
It is not always obvious what data means
Analysing collected data is very difficult.
Professional statisticians should be consulted
if available.
Data analysis must take local circumstances
into account.
129
Measurement Surprises
Reducing the number of faults in a program
leads to an increased number of help desk
calls
The program is now thought of as more reliable and
so has a wider more diverse market. The percentage
of users who call the help desk may have decreased
but the total may increase;
A more reliable system is used in a different way from
a system where users work around the faults. This
leads to more help desk calls.
130
Limitations of Quality Metrics
Budget constraints in allocating the necessary resources.
Human factors, especially opposition of employees to evaluation of their
activities.
Validity Uncertainty regarding the data's, partial and biased reporting.
[Galin2004]
Metrics assumptions:
A software property can be measured.
The relationship exists between what we can measure and what we want to
know. We can only measure internal attributes but are often more interested in
external software attributes.
This relationship has been formalised and validated.
It may be difficult to relate what can be measured to desirable external quality
attributes.
[Sommerville2004]
131
Examples of Software Metrics that
exhibit Severe Weaknesses
132
Factors Affecting Parameters used
for Development Process Metrics
Programming style (KLOC).
Volume of documentation comments (KLOC).
Software complexity (KLOC, NCE).
Percentage of reused code (NDE, NCE).
Professionalism and thoroughness of design review
and software testing teams: affects the number of
defects detected (NCE).
Reporting style of the review and testing results:
concise reports vs. comprehensive reports
(NDE,NCE).
133
Factors Affecting Parameters used
for Maintenance Metrics
Quality of installed software and its documentation
(NYF, NHYC).
Programming style and volume of documentation
comments included in the code be maintained
(KLMC).
Software complexity (NYF).
Percentage of reused code (NYF).
Number of installations, size of the user population
and level of applications in use: (NHYC, NYF).
134
Factors Affecting Parameters used
for Product Metrics
Programming style
Architectural styles/Architectures
Thorough understanding of the domain
(more intensive use of inheritance)
Level of reuse and use of frameworks
135
The Function point approach for software
sizing was invented by Allan Albrecht in
1979
The measure of Albrecht - Function Point
Analysis (FPA) - is well known because of its
great advantages:
Independent of programming language and technology.
Comprehensible for client and user.
Applicable at early phase of software life cycle.
136
The Function Point Method
The function point estimation process:
Stage 1: Compute crude function points
(CFP).
Stage 2: Compute the relative complexity
adjustment factor (RCAF) for the project.
RCAF varies between 0 and 70.
Stage 3: Compute the number of function
points (FP):
FP = CFP x (0.65 + 0.01 x RCAF)
137
Complexity Levels
In function point analysis (FPA), measuring the complexity of different elements such as
user inputs, outputs, online queries, logical files, and external interfaces is crucial for
calculating the function point count. Here are the criteria used to determine their
complexity levels:
1. User Inputs (External Inputs - EI)
User inputs refer to data entered into the system from external sources. The complexity
levels depend on the number of data elements and the types of processing involved.
Low Complexity (1 point):
Simple data input with minimal processing (e.g., data entry forms).
Few data elements (1 to 5).
Average Complexity (2 points):
Moderate data input requiring validation or minor calculations.
More data elements (6 to 19).
High Complexity (3 points):
Complex data input with significant processing (e.g., calculations, validation, or
multiple screens).
Many data elements (20 or more).
138
Complexity Levels
2. User Outputs (External Outputs - EO)
User outputs are the results presented to the user, including reports and
messages. Their complexity is based on the number of data elements and
the type of output processing.
Low Complexity (1 point):
Simple reports or messages with minimal formatting.
Few data elements (1 to 5).
Average Complexity (2 points):
Moderate reports or messages with some processing or formatting.
More data elements (6 to 19).
High Complexity (3 points):
Complex reports or messages requiring significant formatting,
sorting, or calculations.
Many data elements (20 or more).
139
Complexity Levels
3. User Online Queries (External Inquiries - EQ)
Online queries refer to user interactions where they request information or
perform a search. Complexity is based on the number of data elements and
the query’s processing complexity.
Low Complexity (1 point):
Simple queries with minimal processing (e.g., display a single record).
Few data elements (1 to 5).
Average Complexity (2 points):
Queries with moderate processing, such as retrieval and display of
multiple records.
More data elements (6 to 19).
High Complexity (3 points):
Complex queries with significant processing, such as aggregating or
sorting large datasets.
Many data elements (20 or more).
140
Complexity Levels
4. Logical Files (Internal Logical Files - ILF)
Logical files are internal data structures used for storing information. The
complexity depends on the number of data elements and the file’s structure.
Low Complexity (1 point):
Small files with simple structures (e.g., a single table or list).
Few data elements (1 to 5).
Average Complexity (2 points):
Files with moderate complexity, such as multiple related tables or files.
More data elements (6 to 19).
High Complexity (3 points):
Large or complex files with many relationships or intricate data
structures.
Many data elements (20 or more).
141
Complexity Levels
5. External Interfaces (External Interface Files - EIF)
External interfaces refer to data that is used by the system but maintained outside the system boundary. Complexity is based on
the number of data elements and the integration complexity.
Low Complexity (1 point):
Simple data exchanges with external systems (e.g., file imports or exports).
Few data elements (1 to 5).
Average Complexity (2 points):
Moderate external interfaces with some integration or data transformation.
More data elements (6 to 19).
High Complexity (3 points):
Complex external interfaces requiring significant data transformation, validation, or integration.
Many data elements (20 or more).
General Considerations for Complexity Level:
Data Elements: These are the individual units of data handled by the system, like fields or variables in files or records.
Processing Logic: Complexity increases when data requires more elaborate processing such as calculations, sorting, or
aggregation.
External Interactions: Integration with external systems or user interfaces introduces more complexity due to the need for
more robust data handling or error-checking mechanisms.
File Structure: More complex structures, such as those with relationships or hierarchical data, increase the complexity level.
The function point calculation process involves assigning these complexity values to each component based on its
characteristics and then summing them up to determine the overall function point count for the software application.
142
Function Point Method
An example: The Attend
Master
143
Attend Master Software System
Attend-Master is a basic employee attendance
system that is planned to serve small to medium-
sized businesses employing 10–100 employees.
The system is planned to have interfaces to the
company’s other software packages: Human-
Master, which serves human resources units, and
Wage-Master, which serves the wages units.
Attend-Master is planned to produce several
reports and online queries.
144
145
Calculation of CFP
Crude Function Points
Analysis of the software system as presented in
the DFD summarizes the number of the various
components:
Number of user inputs – 2
Number of user outputs – 3
Number of user online queries – 3
Number of logical files – 2
Number of external interfaces – 2.
The degree of complexity (simple, average or
complex) was evaluated for each component.
146
Crude Function Points: Calculation
Complexity level Total
Software Simple average complex CFP
system Count Weight Points Count Weight Points Count Weight Points
Factor Factor Factor
components
A B C= D E F= G H I=
AxB DxE GxH
147
Calculation of RCAF
Relative Complexity Adjustment Factor
148
No Subject Grade
149
FP = CFP x (0.65 + 0.01 x RCAF)
150
Converting NFP 2 KLOC
• The estimates for the average number of lines of
code (LOC) required for programming a function
point are the following:
For C++:
KLOC = (85.86 * 64)/1000 = 5.495 KLOC
151
The function point metric was originally designed to be applied to business
information systems applications.
The data dimension was emphasized to the exclusion of the functional and
behavioral (control) dimensions.
The function point measure was inadequate for many engineering and
embedded systems
Feature points : A superset of the function point, designed for
applications in which algorithmic complexity is high (real-time, process
control, embedded software applications).
152
UCPs
UCPs are based on the number of actors, scenarios, and
various technical and environmental factors in the use case
diagram.
The UCP equation is based on four variables:
Technical complexity factor (TCF)
Environment complexity factor (ECF)
Unadjusted use case points (UUCP)
Productivity factor (PF)
which yield the equation:
UCP = TCP * ECF * UUCP * PF
153
Advantages & Disadvantages
Main advantages
Estimates can be prepared at the pre-project stage.
Based on requirement specification documents (not specific
dependent on development tools or programming languages), the
method’s reliability is relatively high.
Main disadvantages
While tools exist to support FPA, many steps in the process (e.g.,
identifying and categorizing functions) require manual analysis and are not
fully automatable.
Estimates based on detailed requirements specifications, which are not
always available.
The entire process requires an experienced function point team and
substantial resources.
The evaluations required result in subjective results.
Successful applications are related to data processing. The method
cannot yet be universally applied.
154
3. Cost of Quality
Overview:
Objectives of cost of software quality metrics
The classic model of cost of software quality
Galin’s extended model for cost of software
quality
Application of a cost of software quality
system
Problems in the application of cost of
software quality metrics
155
Objectives
In general – it enables management to achieve
economic control over SQA activities and
outcomes. The specific objectives are:
Control organization-initiated costs to prevent
and detect software errors.
Evaluation of the economic damages of software
failures as a basis for revising the SQA budget.
Evaluation of plans to increase or decrease of
SQA activities or to invest in SQA infrastructure on
the basis of past economic performance.
156
Performance Comparisons
Control Budgeted expenditures (for SQA
prevention and appraisal activities).
Previous year’s failure costs
Previous project’s quality costs (control costs
and failure costs).
Other department’s quality costs (control costs
and failure costs).
157
Evaluating SQA Systems
Cost metrics examples:
Percentage of cost of software quality out of
total software development costs.
Percentage of software failure costs out of
total software development costs.
Percentage of cost of software quality out of
total software maintenance costs.
Percentage of cost of software quality out of
total sales of software products and software
maintenance.
158
Model of Software Quality Costs
Prevention costs
Costs of
control costs
Appraisal costs
Cost of
software
quality
Internal failure
Costs of costs
Failure of
control costs
External failure
costs
159
Prevention Costs
Investments in development of SQA infrastructure
components
Procedures and work instructions
Support devices: templates, checklists etc
Software configuration management system
Software quality metrics
Regular implementation of SQA preventive
activities:
Instruction of new employees in SQA subjects
Certification of employees
Consultations on SQA issues to team leaders and others
Control of the SQA system through performance of:
Internal quality reviews
External quality audits
Management quality reviews
160
Appraisal Costs
Costs of reviews:
Formal design reviews (DRs)
Peer reviews (inspections and walkthroughs)
Expert reviews
Costs of software testing:
Unit, integration and software system tests
Acceptance tests (carried out by customers)
Costs of assuring quality of external
participants
161
Internal Failure Costs
Costs of redesign or design corrections
subsequent to design review and test findings
Costs of re-programming or correcting programs
in response to test findings
Costs of repeated design review and re-testing
(regression tests)
162
External Failure Costs
Typical external failure costs cover:
Resolution of customer complaints during the warranty period.
Correction of software bugs detected during regular operation.
Correction of software failures after the warranty period is over even if
the correction is not covered by the warranty.
Damages paid to customers in case of a severe software failure.
Reimbursement of customer's purchase costs.
Insurance against customer's claims.
163
Galin’s Extended Model of
Software Quality Costs
Prevention costs
165
Managerial Failure Costs
Unplanned costs for professional and other resources,
resulting from underestimation of the resources in the
proposals stage.
Damages paid to customers as compensation for late
project completion, a result of the unrealistic schedule in
the Company’s proposal.
Damages paid to customers as compensation for late
completion of the project, a result of management’s failure
to recruit team members.
Domino effect: Damages to other projects planned to be
performed by the same teams involved in the delayed
projects. The domino effect may induce considerable
hidden external failure costs.
166
Application
Definition of a cost of software quality model
and specification of cost items.
Definition of the method of data collection for
each cost item.
Application of a cost of software quality
system, including thorough follow up.
Actions taken in response to the findings.
167
Cost of Software Quality
Balance by Quality Level
Quality
costs Total
cost of
Minimal software
total cost quality
of
software
quality
Total
Total control
failure of costs
control
costs
low high Software quality level
Optimal
software
quality
level
168
Problems of Application
General problems:
Inaccurate and/or incomplete identification and classification of quality costs.
Negligent reporting by team members
Biased reporting of software costs, especially of “censored” internal and external
costs.
Biased recording of external failure costs - “camouflaged” compensation of
customers for failures.
169
4. Discussion & Summary
Components of Project Progress Control
requires (1) control of risk management activities,
(2) project schedule control, (3) project resource
control, and (4) project budget control. Even though
budget control has usually the highest priority,
only the combination of all control tasks ensures
the required coverage of risks
Metrics facilitate management control, planning
and managerial intervention based on deviations of
actual from planned performance to identify
situations for development or maintenance process
improvement (preventive or corrective actions)
170
Discussion & Summary
Metrics must be relevant, valid, reliable, comprehensive, and
mutually exclusive. In addition, it must be easy and simple,
should not require independent data collection, and should
be immune to biased interventions by interested parties.
Available metrics for control are process metrics, which are
related to the software development process, maintenance
metrics, which are related to software maintenance (called
product metrics in [Galin2004]), and product metrics, which
are related to software artifacts.
Metrics are used to measure quality, accordance with
timetables, effectiveness (of error removal and
maintenance services), and productivity.
171
Discussion & Summary
A software measurement process may should be
part of a quality control process which (1) defines
the employed software quality metrics, (2) selects
components to be assessed, (3) collects the data,
(4) ensures that anomalous measurements are
identified, and (5) are analyzed. But due to the
complex interdependencies unexpected effects are
possible (measurement surprises)
The optimal software quality level is reached
when the sum of the total failure of control costs
and total control costs is minimal.
172
Lecture 5
173
Outline
174
III.1 Foundations
175
Verification & Validation
Verification: refers to the set of activities that
ensure that softwarecorrectly implements a specific function.
Validation: refers to a different set of activities that ensure that
the software that has been built is traceable to customer
requirements.
Boehm [Boehm81]:
Verification: “Are we building the product right?”
Validation: “Are we building the right product?”
The definition of V&V encompasses many of SQA activities,
including
formal technical reviews, quality and configuration audits
performance monitoring, different types of software testing
feasibility study and simulation
176
Terminology: Dynamic/Static
Analysis
Dynamic analysis:
The process of evaluating a system or component based on
its behavior during execution.
Contrast with: static analysis.
See also: demonstration; testing.
[IEEE-610.12-1990]
Static analysis:
The process of evaluating a system or component based on
its form, structure, content, or documentation.
Contrast with: dynamic analysis.
See also: inspection; walk-through.
[IEEE-610.12-1990]
177
Dynamic vs. Static Analysis
Dynamic analysis (testing):
execution of system components;
running the software
Static analysis:
investigation without operation;
pencil and paper reviews etc.
Modelling (mathematical representation)
178
Terminology: Testing
Several definitions:
“Testing is the process of executing a program or
system with the intent of finding errors.”
[Myers1979]
179
Testing (according to IEEE)
(1) The process of operating a system or component under specified
conditions, observing or recording the results, and making an
evaluation of some aspect of the system or component.
(2) (IEEE Std 829-1983 [5]) The process of analyzing a software
item to detect the
differences between existing and required conditions (that is, bugs)
and to evaluate the features of the software items. See also:
acceptance testing; benchmark; checkout; component testing;
development testing; dynamic analysis; formal testing; functional
testing; informal testing; integration testing; interface testing;
loopback testing; mutation testing; operational testing;
performance testing; qualification testing; regression testing;stress
testing; structural testing; system testing; unit testing.
[IEEE-610.12-1990]
180
Quality Control
Dynamic Activities
Life cycle phase Static &
Modelling
analysis analysis
Requirements
Process X X
Top-level design X X
Detailed design X X
Implementation X X
Integration testing X X X
System validation X X
181
III.2 Static Analysis Techniques
Overview
Reviews and Inspections
Walkthroughs, inspections, personal
reviews
Formal technical reviews
Summary
Other Techniques
Control-flow analysis, data-flow analysis, metrics, …
182
II.2.1 Reviews and Inspections
A family of techniques
Personal reviews
Inspections
Walkthroughs
Formal technical reviews
Review / inspect
To examine closely, With an eye toward
correction or appraisal
People (peers) are the examiners 183
Purpose/Objectives
Verify that software meets its requirements software
follows predefined standards software is developed in
uniform manner
Catching errors
Sooner
More and different
Make projects more manageable
To identify new risks likely to affect the project
Improving communication
Crossing organization boundaries
Providing Education
Making software visible
184
(1) Personal Review
Features
Informal
Done by the producer
Implications
Not objective
Available to any developer
Different mindset (A personal review often
reflects the developer's own thought process,
which may differ from that of external
reviewers, potentially limiting critical insights.)
185
Need for review
Conducting personal reviews helps identify issues
early, ensuring that the product is thoroughly
checked before completion.
Product completion
Personal reviews contribute to the overall
progress toward product completion by
addressing preliminary flaws efficiently.
186
(2) Inspections
Inspection is More formal type of walkthrough
•Used to identify specific errors or problems
•assume details are correct, but look for missing items at a global level
•look for occurrences of a particular kind of bug such as buffer overflow.
Features
Team reviews materials separately
187
Process and Participants
188
(3) Walkthroughs
Features
Less formal
Producer presents or provides information
Implications
Larger groups can attend (education)
More material per meeting
Less preparation time
190
What to omit and what to include?
Inclusion:
Sections of complicated logic Critical sections,
where defects severely damage essential system
capability Sections dealing with new environments
Sections designed by new or inexperienced team
members
Omission:
“Straightforward” sections (no complications)
Sections of a type already reviewed by the team in
similar past projects Sections that, if faulty, are not
expected to effect functionality Reused design and
code Repeated parts of the design and code
191
(4) Formal Technical Review
Features
Formal
Scheduled event
Defined procedure
Reported result
Independent review team
Producers not present
Implications
More preparation time
Less material per meeting
Product must stand or fall on its own
192
Formal Technical Review (FTR)
Process
Phases (Orientation) and procedures (Checklists)
Roles
Author, Moderator, Reader, Reviewer, Recorder
Objectives
Defect removal, requirements elicitation, etc.
Measurements
Forms, consistent data collection, etc.
193
FTR Process
How much to review
Review pacing
When to review
Pre-meeting preparation
Meeting pace
194
How Much to Review?
Tied into meeting time (hours)
Should be manageable
Break into chunks if needed
195
Review Pacing
How long should the meeting last?
Based on:
Lines per hour?
Pages?
Specific time frame?
196
When to Review?
How much work should be completed before the
review
Set out review schedule with project planning
Again, break into manageable chunks
Prioritize based on impact of code module to overall
project
197
Pre-Meeting Preparation
Materials to be given to reviewers
Time expectations prior to the meeting
Understand the roles of participants
Training for team members on their various
roles
Expected end product
198
Pre-Meeting Preparation (2/2)
How is document examination conducted?
Ad-hoc
Checklist
Specific reading techniques (scenarios or
perspective-based reading)
199
FTR Team Roles
200
FTR Team Roles (2/2)
Author
Moderator
Reader
Reviewer
Recorder (optional?)
201
202
Team Participants
Must be actively engaged
Must understand the “bigger picture”
203
Team Psychology
Stress
Conflict resolution
Perceived relationship to performance reviews
204
Team Size
What is the ideal size for a team?
Less than 3?
3-6?
Greater than 6?
What is the impact of large, complex projects?
How to work with globally distributed teams?
205
FTR Objectives
Review meetings can take place at various stages of
the project lifecycle
Understand the purpose of the review
Requirements elicitation
Defect removal
Other
Goal of the review is not to provide solutions
Raise issues, don’t resolve them
206
FTR Measurements
Documentation
Sample forms
Inspection metrics
207
Documentation
Forms used to facilitate the process
Documenting the meeting
Use of standards
How is documentation used by:
Managers
Developers
Team members
208
Sample Forms
209
Beyond the FTR Process
Impact of reviews on the programmer
Post-meeting activities
Review challenges
Survey of reviews and comparisons
Future of FTR
210
Impact on the Programmer
Should reviews be used as a measure of
performance during appraisal time?
Can it help to improve commitment to their
work?
Will it make them a better reviewer when
roles are reversed?
Improve teamwork?
211
Post-Meeting Activities
Defect correction
How to ensure that identified defects are
corrected?
What metrics or communication tools are
needed?
Follow-up
Feedback to team members
Additional phases of reviews
Data collection for historical purposes
Gauging review effectiveness
212
Review Challenges
Distributed, global teams
Large teams
Complex projects
Virtual vs. face-to-face meetings
213
Survey of Reviews
Reviews were integrated into software development
with a range of goals
Early defect detection
Better team communication
Review approaches vary widely
Tending towards nonsystematic methods and
techniques
Source: Ciolkowski, M., Laitenberger, O., & Biffl, S. (2003). Software reviews,
the state of the practice. Software, IEEE, 20(6), 46-51.
214
Survey of Reviews (2/2)
What were common review goals?
Quality improvement
Project status evaluation
Means to enforce standards
Common obstacles
Time pressures
Cost
Lack of training (most train by participation)
215
Do We Really Need a Meeting?
“Phantom Inspector” (Fagan)
The “synergism” among the review team
that can lead to the discovery of defects not
found by any of the participants working
individually
Meetings are perceived as higher quality
What about false positives and duplicates?
216
A Study of Review Meetings
The need for face-to-face meetings has never
been questioned
Meetings are expensive!
Simultaneous attendance of all participants
Preparation
Readiness of work product under review
High quality moderation
Team personalities
Adds to project time and cost
(15-20% overhead)
217
A Study of Review Meetings (2/3)
Studied the impact of:
Real (face-to-face) vs. nominal (individual)
groups
Detection effectiveness (number of defects
detected)
Detection cost
Significant differences were expected
218
A Study of Review Meetings (3/3)
Results
Defect detection effectiveness was not
significantly different for either group
Cost was less for nominal than for real groups
(average time to find defects was higher)
Nominal groups generated more issues, but
had higher false positives and more duplication
219
Does Openness and Anonymity
Impact Meetings?
“Working in a group helped me find errors
faster and better.”
“Working in a group helped me understand
the code better.”
“You spent less time arguing the issue
validity when working alone.”
“I could get a lot more done in a given
amount of time when working by myself.”
220
Study on Successful Industry Uses
Lack of systematic execution during preparation
and detection
60% don’t prepare at all, only 50% use
checklist, less than 10% use advance reading
techniques
Reviews are not part of an overall improvement
program
Only 23% try to optimize the review process
221
Study on Successful Industry Uses
(2/3)
Factors for sustained success
Top-management support is required
Need evidence (external, internal) to warrant
using reviews
Process must be repeatable and measurable for
continuous improvement
Techniques need to be easily adaptable to
changing needs
222
Study on Successful Industry Uses
(3/3)
Repeatable success tends to use well defined
techniques
Reported success (NASA, Motorola, IBM)
95% defect detection rates before testing
50% overall cost reduction
50% reduction in delivery time
223
Future of FTR
1. Provide tighter integration between FTR and the
development method
2. Minimize meetings and maximize asynchronicity in
FTR
3. Shift the focus from defect removal to improved
developer quality
4. Build organizational knowledge bases on review
5. Outsource review and in-source review knowledge
6. Investigate computer-mediated review technology
7. Break the boundaries on review group size
224
Category/Attribute Management Technical Inspection Walkthrough
Objective Ensure Progress. Evaluate conformance to Detect and identify Detect defects.
Recommend corrective specifications and plans. defects. Examine alternatives.
action. Ensure proper Ensure change integrity. Verify resolution. Forum for learning.
allocation of resources.
Delegated Controls Management team charts Review team petitions Team chooses All decisions made by
Decision making course of action. management of technical predefined product producer. Change is the
Decisions leadership to act on dispositions. Defects prerogative of the
are made at the meeting recommendations. must be removed. producer.
or as a result of
recommendations.
Change verification Change verification left to Leader verifies as part of Moderator verifies rewo rk.Change verification left to
other project controls. review report. other project controls.
Group Dynamics 2 or more people 3 or more people 3-6 people 2-7 people
Recommended size
Attendance Management, technical Technical leadership and College of peers meet Technical leadership and
leadership, and peer mix. peer mix. with documented peer mix.
attendance.
Leadership Usually the responsible Usually the lead engineer. Trained moderator. Usually producer.
manager.
Procedures Moderate to high, Moderate to high, Relatively low. Relatively low.
Material volume depending on the specific depending on the specific
“statement of objectives” “statement of objective”
at the meeting. for the meeting.
Presenter Project representative Software element Presentation by “reader” Usually the producer
representative. other than producer.
Data collection As required by applicable Not a formal project Formally required. Not a formal project
policies, standards, or requirement. May be requirement. May be
plans. done locally. done locally.
Outputs Management review Technical review report. Defect list. Defect Walkthrough report.
Reports report. summary. Inspection
report.
Database entries Any schedule changes No formal database Defect counts, No formal database
must be entered into the required. characteristics, severity, required.
project tracking database. and meeting attributes 225
are kept.
Cost-Benefit Analysis
Fagan reported that IBM inspections found
90% of all defects for a 9% reduction in
average project cost
Johnson estimates that rework accounts for
44% of development cost
Finding defects, finding defects early and
reducing rework can impact the overall cost of
a project
226
Cost of Defects
What is the impact of the annual cost of software
defects in the US?
$59 billion
Estimated that $22 billion could be avoided by
introducing a best-practice defect detection
infrastructure
Source: NIST, The Economic Impact of Inadequate
Infrastructure for Software Testing, May 2002
227
Software Inspections
Why are software inspections not widely used?
Lack of time
Not seen as a priority
Not seen as value added (measured by loc)
Lack of understanding of formalized techniques
Improper tools used to collect data
Lack of training of participants
Pits programmer against reviewers
228
Other Techniques
Covered: Static analysis:
Static Code Analysis
The process of
Formal Methods
evaluating a system
Model Checking
or component based
on its form,
Static analysis:
structure, content,
investigation without
operation; or documentation.
pencil and paper reviews [IEEE-610.12-1990]
etc.
Modelling (mathematical
representation)
229
Static Analysis Techniques (1/2)
Static Code Analysis
Control flow analysis
data flow analysis
symbolic execution
Timing analysis
Performance/scheduling theories
Formal Methods
Discrete mathematics, logics, temporal logics, process
algebra, …
Model Checking
Fully automatic analysis of formal models w.r.t. a formal
specification
230
III.3 Dynamic Testing Techniques
Common definition [Myers1979] :
Testing is a process of executing a program with the
intent of finding an error.
A good test case is one that has high probability of finding
an undiscovered error.
A successful test is one that uncovers an as-yet
undiscovered error.
Also: testing to assess reliability
(not considered here)
231
Test:
(1) An activity in which a system or component is executed under
specified conditions, the results are observed or recorded, and an
evaluation is made of some aspect of the system or component.
(2) To conduct an activity as in (1).
(3) (IEEE Std 829-1983 [5]) A set of one or more test cases.
(4) (IEEE Std 829-1983 [5]) A set of one or more test procedures.
(5) (IEEE Std 829-1983 [5]) A set of one
or more test cases and procedures.
[IEEE-610.12-1990]
232
Objectives
Design tests that systematically uncover defects
Maximize bug count: uncover as many defects (or bugs) as possible
Using the minimum cost and efforts, within the limits budgetary/scheduling
Guide correction such that an acceptable level of quality is reached
Help managers make ship / no-ship decisions
Assess quality (depends on the nature of the product)
Block premature product releases; Minimize technical support costs
It is impossible to verify correctness of the product by testing, but you can
prove that the product is not correct or you can demonstrate that you didn’t
find any errors in a give time period.
Minimize risks (especially safety-related lawsuit risk):
Assess conformance to specification
Conform to regulations
Find safe scenarios for use (find ways to get it to work, in spite of the bugs)
Indirect objectives
To compile a record of software defects for use in error prevention
(by corrective and preventive actions)
233
Testing Fundamentals
Software Testing is a critical element of Software QualityAssurance
It represents the ultimate review of the requirements specification,
the design, and the code.
It is the most widely used method to insure software quality.
Many organizations spend 40-50% of development time in testing.
Testing is the one step in software engineering process that could be
viewed as destructive rather than constructive.
“A successful test is one that breaks the software.” [McConnell 1993]
A successful test is one that uncovers an as yet undiscovered
defect.
Testing can not show the absence of defects, it can only show that
software defects are present.
For most software exhaustive testing is not possible.
234
Test Cases & Set of Test Cases
“Adequate” Set of Test Cases?
Describe how to test a
system/module/function
Objective:
Description must identify to uncover as many defects as
system state before executing possible
the test
Test set criteria:
system/module/function does the set cover the system in
to be tested a complete/sufficient manner
235
Model of Testing (1/2)
Inputs causing
anomalous
behaviour
Input test data I
System
236
Model of Testing (1/2)
Unexpected
outcome
The Environment
environment model
The Program
program model Tests
237
Testing Approaches
Black box testing
1. Testing that ignores the internal mechanism of the
system or component and focuses solely on the outputs in
response to selected inputs and execution conditions
2. Testing conducted to evaluate the compliance of a system
or component with specified functional requirements
(sometimes named functional testing)
White box testing
Testing that takes into account the internal mechanism of a
system or component(sometimes named structural testing)
IEEE
238
III.3.2 Black Box Testing
Techniques
An approach to testing Black box testing:
where the program is (1) Function testing
considered as a “black- (2) Domain testing
box” (3) Specification-based testing
(4) Risk-based testing
requirements
(5) Stress testing
(6) Regression testing
(7) User testing
input output (8) Scenario testing
(9) State-model based testing
events (10) High volume automated testing
(11) Exploratory testing
Not orthogonal!
239
(1) Function Testing
variable in isolation. Test each function / feature /
Usually start with fairly simple function testing
focuses on a single function and tests it with
middle-of-the-road values don’t expect the
program to fail but if it fails the algorithm is
fundamentally wrong, the build is broken, or …
Later switch to a different style which often involves
the interaction of several functions
These tests are highly credible and easy to evaluate
but not particularly powerful
240
(2) Domain Testing
Essence: sampling
Equivalence class testing:
Look at each variable domains (including invalid values)
reduce a massive set of possible tests (domain) into a small group by
partitioning
picking one or two representatives from each subset.
look for "best representative“: a value that is at least as likely to
expose an error as any other
Boundary value analysis: A good test set for a numeric variable hits
every boundary value because boundary / extreme-value errors are common
use the minimum, the maximum, a value barely below the minimum, and a
value barely above the maximum bugs are sometimes dismissed, especially
when you test extreme values of several variables at the same time (corner
cases)
241
Equivalence Partitioning
Input data and output
results often fall into
Valid inputs
different classes Invalid inputs
in an “equivalent” way
Test cases should be
chosen from each partition
Outputs
242
Equivalence Partitioning
an approach that divides the input domain of a program
into classes of data from which test cases can be derived.
Example: Suppose a program computes the value of the
function. ( X −1) ∗( X 2) This function defines
the following
valid and invalid equivalence classes:
X < = -2 valid
-2 < X < 1 invalid
X >= 1 valid
Test cases would be selected from each equivalence
class.
243
Boundary Value Analysis (1/2)
a testing technique where test cases are
designed to test the boundary of an input
domain. “Bugs lurk in corners
Boundary value analysis complements and congregate at
boundaries…”
and can be used in conjunction with Boris Beizer
equivalence partitioning.
Example (cont.): boundary values of the
three ranges have to be included in the
test data. That is, we might choose the
following test cases:
X <= -2 MIN, -100, -2.1, -2
-1.9, -1, 0, 0.9
-2 < X < 1 1, 1.1,100, MAX
X >= 1
244
Boundary Value Analysis (2/2)
If an input condition specifies a range [a, b]: Example: [-3, 10],
test values: 0 (interior point); 0 is always good candidate!
test values: -3, 10 (extreme points)
test values: -2, 9 (boundary points)
test values: -4, 11 (off points)
If an input condition specifies a number values:
minimum and maximum
values just above and below minimum and
maximum
Also for more complex data (data structures):
array
input condition: empty, single element, full element, out-of-
boundary
search for element: element is inside array or not
You can think about other data structures: list, set, stack, queue,
and tree 245
(3) Specification-Based Testing
Check the program against a reference document design specification,
a requirements list, a user interface description, a model, or a user
manual.
Rational:
the specification might be part of a contract products must conform to
their advertisements safety-critical products must conform to any
safety-related specification.
Observation
Specification-driven tests are often weak, not particularly powerful
representatives of the class of possible tests
Different approaches:
focus on the specification: the set of test cases should include an
unambiguous and relevant test for each claim made in the spec. look
further, for problems in the specification: explore ambiguities in the
spec. or examine aspects of the product that were not well-specified
246
(4) Risk-Based Testing
Process
(1) Imagine a way the program could fail (cf. error guessing)
(2) design one or more tests to check for it
a good risk-based test = a powerful representative that address
a given risk.
“complete”: a list of every way the program could fail.
If tests tie back to
significant failures in the field or
well known failures in a competitor’s product failure will be
highly credible and highly motivating
However, many risk-based tests are dismissed as academic
(unlikely to occur in real use).
Test for possible problem carry high information value
(We learn a lot whether the program passes the test or not)
247
(5) Stress Testing
Different definitions of stress testing:
Hit the program with a peak burst of activity and see it fail.
Testing conducted to evaluate a system or component at or beyond the
limits of its specified requirements with the goal of causing the system to
fail. [IEEE Standard 610.12-1990]
Driving the program to failure in order to watch how the program fails.
Keep increasing the size or rate of input until either the program finally fails
or
you become convinced that further increases won’t yield a failure.
Look at the failure and ask what vulnerabilities have been exposed and which
of them might be triggered under less extreme circumstances.
Discussion:
stress test results as not representative of customer use
One problem with stress testing is that a failure may not be easily analyzed
(must includes enough diagnostic support)
stress-like tests can expose failures that are hard to see if the system is not
running with a high load (e.g., many concurrent tasks)
248
(6) Regression Testing
Process
(1) design tests with the intent of regularly reusing them
(2) repeat the tests after making changes to the program.
A good regression test is designed for reuse.
adequately documented and maintainable
designed to be likely to fail if changes induce errors in the addressed part
of the program
Discussion:
First run of the tests may have been powerful, but after passed
many times detecting defects is not very likely (unless there have
been major changes or changes in part of the code directly involved
with this test.) Usually carries little information value
Automation can make regression testing very “cheap”
249
Requirements changes
Regression Testing Process
Affect design, coding, and
Software Change
testing document update
Analysis
Design changes
Software Change
Affect coding, tests, associated
Impact Analysis
components, system architecture,
Build Regression
Test Suite
Affect test cases, test data, test scripts,
Run RegressionTests at
Test changes
different levels
Affect other tests and test documentation
Report Retest
Document changes
Results
Affect other document
250
Regression Testing Strategies
Random: The test cases are randomly selected from the
modified program.
Remark ([Juriso+2004]):
For small programs and set of test cases is small, then retest-all.
Use safe techniques for large programs and programs with a large
251
(7) User Testing
The testing done by real users (Not testers pretending to be users)
User tests might be designed by
the users,
the testers, or
other people (sometimes even by lawyers; acceptance tests in a contract)
Continuum:
tests can be designed in such detail that the user merely executes them reports
whether the program passed or failed
a carefully scripted demonstration, without much opportunity to detect defects
Leave the user some freedom to
cognitive activity while providing enough structure to ensure effective reports (in a way that
helps readers understand and troubleshoot the problem)
detect problems a user will encounter in real use is much more difficult
Failures found in user testing are typically credible
252
Beta tests:
often described as cheap, effective user tests
but in practice they can be quite expensive to
administer
you may not yield much information.
automation required!
253
(8) Scenario Testing
Check how the program copes with a scenario
Good scenario test should be
credible,
motivating,
easy to evaluate, and
complex.
How often run a given scenario test?
Some create a pool of scenario tests as regression tests
Others run a scenario once or a small number of times and then design
another scenario rather than sticking with the ones they’ve used before
Scenarios help to develop insight into the product
Early in testing (understand the product at all) or
Late in testing (understand advanced uses of a stabilized product)
harsher test: rarely be used by typical users (cf. stress testing)
254
(9) State-Model-Based Testing
Model the visible behavior of the program as a state machine
Checking for conformance with the state machine model
Approach is credible, motivating and easy to troubleshoot
Tradeoffs:
state-based testing often involves simplification and if the model is
oversimplified, failures exposed by the model can be false negatives and
difficult to troubleshoot
more detailed models find more bugs, but can be much harder to read and
maintain
Experiences shows that much of the bug-finding happens while
modeling the state models rather than testing
coverage criteria / stopping rule (cf. [Al-Ghafees&Whittaker2002])
255
State-Model-Based Testing
Uncovers the following issues:
Wrong number of states.
Wrong transition for a given state-input combination.
Wrong output for a given transition.
States or sets of states that have become dead.
States or sets of states that have become unreachable.
Test sequence:
Define a set of covering input sequences that
starting from the initial state and get back to the initial state
For each step in the input sequence, defines the expected next state, the expected
transition, and the expected output code
Remarks:
Completeness: transitions and outputs for every combination of input and states
Instrument the transitions to also capture the sequence of states (not just the outputs)
Count the states
256
Variant: Syntax Testing
Test model: BNF-based syntax instead of state machine
E.g., for testing command-driven software
Dirty syntax testing:
a) to exercise a good sample of single syntactic errors in all
commands in an attempt to break the software.
b) to force every diagnostic message appropriate to that
command to be executed.
Example test cases: Syntax Graph for <real_number>:
.
correct ones <digital> <digital>
1.54683e5,
1.6548
incorrect without loops:
.05 E
1. e <digital>
1.1e
D +
incorrect with loops: d -
123456.78901.1
1.12345e6789D-123
257
(10) High-Volume Automated
Testing
Massive numbers of tests, comparing the results against a partial
oracles.
The simplest partial oracle: crashing
State-model-based testing (if the stopping rule is not based on a coverage
criterion) or also more general notion of stochastic state-based testing
[Whittaker1997].
Randomly corrupt input data
Repeatedly feeds random data to the application under test and a reference
oracle in parallel [Kaner2000] (back-to-back testing)
Run arbitrarily long random sequence of regression tests to let memory
leaks, stack corruption, wild pointers or other garbage that cumulates over
time finally causes failures. Probes (tests built into the program) can be
used to expose problems. [Kaner2000]
An almost complete automation for the testing is required
The low power of individual tests is make up for with massive numbers
258
(11) Exploratory Testing
any testing which uses information gained while testing to better test
continuum between
purely scripted (the tester does precisely what the script specifies and nothing
else) to purely exploratory (no pre-specified activities, not documentation
beyond bug reports is required)
prototypic case/ “freestyle exploratory testing”
exploratory testers continually learn about the software, the context, the ways it
could fail, its
weaknesses, and the best ways to test the software.
At the same time they are also test the software and report the problems
Test cases are good to the extent that they advance the tester’s knowledge
(goal-driven)
as the tester gains new knowledge the goals may also change quickly
which type of testing: what is most likely to reveal the information the tester is
looking for
259
Not purely spontaneous:
studying competitive products,
review failure histories of this and analogous
products
interviewing programmers and users,
reading specifications, and
working with the product.
state models can serve as an exploratory testing
tool
260
III.3.3 White Box Testing
Techniques
Black box testing:
Requirements fulfilled
Interfaces available
and working
of a component,
interactions between
objects?
261
(1) Control Flow Testing: Example
procedure XYZ is 1
A,B,C: INTEGER;
begin 2
1. GET(A); GET(B); GET(C);
2. if (A > 15 and C > 20) then
3 9
3. if B < 10 then
4. B := A + 5;
5. else 4 6
6. B := A - 5;
7. end if
8. else 7
9. A := B + 5;
10. end if;
10
end XYZ;
262
Control Flow Testing
a) Statement coverage: The test cases are
263
a) Statement Coverage
Statement 1
coverage: 2
The test cases are generated so
that all the program statements
are executed at least once. 3 9
4 6
10
264
b) Decision / Branch Coverage
Decision 1
coverage 2
(branch
coverage): The 3 9
test cases are
generated so 4 6
that the program
decisions take
the value true or 7
false.
10
265
c) Condition Coverage (1/2)
1
Conditioncoverage: The
test cases are generated 2
so that all the program
conditions (predicates) 3 9
that form the logical
expression of the 4 6
decision take the value
true or false.
7
10
266
Simple Condition Coverage
Composed condition:
((A and B) or C) A B C (A and B) or C
Test cases must cover all TRUE TRUE TRUE TRUE
the values true or false for TRUE TRUE FALSE TRUE
each conditions (predicates)
of the logical expression TRUE FALSE TRUE TRUE
268
d) Path Coverage
1
Path coverage: Test cases are
generated to 2
execute all/some program paths.
Why path coverage?
logic errors and incorrect 3 9
assumptions are inversely
proportional to a path’s execution
4 6
probability we often believe that a
path is not likely to be executed; in
fact, reality is often counter 7
intuitive it’s likely that untested
paths will contain some undetected
defects 10
269
Exhaustive Testing Not Possible
There are 1014 possible
paths!
If we execute one test
per millisecond, it
would take 3.170 years
to test this program!!
Out of question
270
Basic Path Testing
Terminology:
execution path: a path that connects a start node and a terminal
node.
Two paths are independent if they have disjoint node or edge sets
Steps:
convert the unit into a “flow graph”
compute a measure of the unit's logical complexity
use the measure to derive a “basic” set of independent
execution paths for which test cases are determined
271
Cyclomatic Complexity
Cyclomatic complexity (McCabe complexity) is a metric,
V(G), that
describes the logical complexity of a flow graph, G.
V(G) = E - N + 2 where E = #edges in G and N = #nodes in G
Studies have shown:
V(G) is directly related to the number of errors in source code
V(G) = 10 is a
practical upper
limit for testing modules in this range
are more error prone
modules
V(G)
272
Path Coverage Testing
Next, we derive the independent paths:
1
Since V(G) = 4, we have 4 paths
Path 1: 1,2,3,6,7,8 2
Path 2: 1,2,3,5,7,8 4 3
Path 3: 1,2,4,7,8
5 6
Path 4: 1,2,4,7,2,4…7,8
Finally, we derive test cases to
exercise these paths, i.e. choose
7
inputs that lead to traversing the
paths 8
273
simple loop Testing Loops
nested
loops
concatenated unstructured
loops loops 274
Loop Testing: Simple Loops
(boundary)
(interior)
275
Testing Nested Loops
276
Comparison: Control Flow Testing
a) Statement coverage: The test cases are generated so
that all the program statements are executed at
least once.
b) Decision coverage (branch coverage): The test cases are
generated so that the program decisions take the
value true or false.
c) Condition coverage: The test cases are generated so
that all the program conditions (predicates) that
form the logical expression of the decision take the value
true or false.
d) Path coverage: Test cases
are generated to execute
all/some program paths.
277
a) Statement Simple condition
coverage coverage
b) Decision
Condition/decision
coverage
coverage
Minimal multiple
condition coverage
Basic
path
coverage
Modified
condition/decision
coverage
Path
coverage
Multiple condition
coverage
278
(2) Data Flow Testing
Basic Definitions:
1
V = the set of variables.
N = the set of nodes
E = the set of edges 2 read(x,y) def (2) = {i}
i:=1; c-use(2) = {x,y}
Definition/write on variables (nodes):
p-use(3,4) = {i}
def(i) = { x in V | x has a global i<=2 3 i>2 p-use(3,5) = {i}
def in block I }
4 5
p-use(6,8) = {y}
Computational-use of variables (nodes): writeln(“hello”); p-use(6,7) = {y}
y>=0
y<0 6
c-use(i) = { x in V | x has a global i:= i+1;
8
c-use in block i } def (4) = {i} 7
c-use(4) = {i}
Predicate-use of variables (edges): 9 writeln(x);
c-use(8) = {x}
p-use(i,j) = { x in V | x has a p-use
in edge (i,j) } 10
279
Idea of Data Flow Testing
Idea: coverage of the a def-clear 1
paths)
280
Data Flow Testing
1
All node with an effective path from a def to a c-use
for variable x:
dcu(x, j) = { j in N | x in c-use(j) and read(x,y) def (2) = {i,x,y}
there is a def-clear path wrt 2
x from i to j } i:=1; c-use(2) = {}
All edges with an effective path from a def to a p-p-use(3,4) = {i} i>2 p-use(3,5) = {i}
use for variable x: i<=2 3
281
Types of Data Flow Testing
All-defs: Test cases are generated to cover each definition of each
variable for at least one use of the variable.
All c-uses: Test cases are generated so that there is at least one path
of each variable definition to each c-use of the variable.
All p-uses: Test cases are generated so that there is at least one path
of each variable definition to each p-use of the variable.
All-c-uses/some-p-uses: Test cases are generated so that there is at
least one path of each variable definition to each c-use of the variable. If
there are variable definitions not covered, use p-uses.
All-p-uses/some-c-uses: Test cases are generated so that there is at
least one path of each variable definition to each p-use of the variable. If
there are variable definitions not covered, use c-uses.
282
Types of Data Flow Testing
All uses: Test cases are generated so that there is at least one path of
each variable definition to each use (read: p-use and c-use) of the
definition.
All-du paths: Test cases are generated for all the possible paths of
each definition of each variable to each use of the definition not
taking
loops into account.
283
Comparison: Data Flow Testing
If time is an issue: All-Paths
All p-uses should be used instead
of all-uses All-DU-Paths
All-uses should be used
All-Uses
instead of all-du-paths
to generate fewer tests: All-C-Uses/Some-P-Uses All-P-Uses/Some-C-Use
285
III.3.4 Comparison
Black box tests: White box tests:
tester has no access to tester can access
information about the information about the
system implementation system implementation
Characteristics: Characteristics:
Good for independence of Simplifies diagnosis of
tester results
But not good for formative Can compromise
tests independence
Hard to test individual How much do they need to
modules... know?
286
III.4 Testing Process & Activities
Beforehand:
Requirement analysis
design analysis
287
Testing Activities
Unit Design System Other Customer User
test specifications functional software requirements environment
requirements requirements specification
Unitcode
Unit
test
Unitcode
Integration Function Performance Acceptance Installation
test test test test test
288
III.4.1 Unit Testing
Individual components are tested independently to ensure their
quality.
The focus is to uncover errors in design and implementation,
including
data structure in a component
program logic and program structure in a component
component interface
functions and operations of a component
There is some debate about what constitutes a “unit”. Some
common definitions:
the smallest chunk that can be compiled by itself
a stand alone procedure of function
something so small that it would be developed by a single person
Unit testers: developers of the components.
289
Example: Test GCD Algorithm
Testing a unit designed to compute the “greatest common divisor”
(GCS) of a pair of integers (not both zero).
GCD(a,b) = c where
c is a positive integer
c is a common divisor of a and b (e.g., c divides a and c divides
b)
c is greater than all other common divisors of a and b.
For example
GCD(45, 27) = 9
GCD (7,13) = 1
GCD(-12, 15) = 3
GCD(13, 0) = 13
GCD(0, 0) undefined
290
Test Planning
How do we proceed to determine the tests cases?
1.Determine appropriate equivalence classes for the
2.input data.
3.Determine the boundaries of the equivalence classes.
4.Design an algorithm for the GCD function.
5.Analyze the algorithm using basic path analysis.
6.Then, choose tests cases that include the basic path
7.set, data form each equivalence class, and data at and
8.near the boundaries.
291
1.
GCD
function gcd (int a, int b) {
Algorithm
2. int temp, value;
3. a := abs(a); 1
4. b := abs(b);
5. if (a = 0) then
6. value := b; // b is the GCD 5
else if (b = 0) then
8. raise exception; 7
9. else
10. loop 6
11. temp := b; 9
12. b := a mod b;
13. a := temp;
14. until (b = 0) 10
15. value := a;
16. end if; 17
17. return value;
18. end gcd
18
292
Example: GCD Test Planning
Equivalence Classes
Although the the GCD algorithm should accept any
integers as input, one could consider 0, positive
integers and negative integers as “special” values.
This yields the following classes:
a < 0 and b < 0, a < 0 and b > 0, a > 0 and b < 0
a > 0 and b > 0, a = 0 and b < 0, a = 0 and b > 0
a > 0 and b = 0, a > 0 and b = 0, a = 0 and b = 0
Boundary Values
a = -231, -1, 0, 1, 231-1 and b = -231, -1, 0, 1, 231-1
Basic Path Set
V(G) = 4
(1,5,6,17,18), (1,5,7,18), (1,5,7,9,10,17,18),
(1,5,7,9,10,9,10,17,18)
293
Example GCD Test Plan
294
Test Description / Data Expected Results Test Experience / Actual Results
Basic Path Set
Equivalence Classes
Boundary Points
(1 , 0) 1
(-1 , 0) 1
(0 , 1) 1
295
(0 , -1) 1
Test Implementation
Once one has determined the testing strategy, and the units to tested, and
completed the unit test plans, the next concern is how to carry on the tests.
If you are testing a single, simple unit that does not
interact with other units (like the GCD unit), then one can
write a program that runs the test cases in the test plan.
The next slide defines some terms that are used in implementing and running test
plan.
296
Test Implementation Terms
Test Driver
a class or utility program that applies test cases to a component being tested.
Test Stub
a temporary, minimal implementation of a component to increase controllability
and observability in testing.
When testing a unit that references another unit, the unit must either be complete
(and tested) or stubs must be created that can be used when executing a test case
referencing the other unit.
Test Harness
A system of test drivers, stubs and other tools to support test execution
297
Test Implementation Steps
Here is a suggested sequence of steps for testing a unit:
298
Testing Tools
299
III.4.2 Integration Testing
A group of dependent components are tested together to ensure their
the quality of their integration unit.
Integration testers:
either developers and/or test engineers.
300
III.4.2 Integration Testing
Tests complete systems or subsystems composed of
integrated components
Integration testing should be black-box testing with tests
derived from the
specification
Main difficulty is localising errors
Incremental integration testing reduces this problem
301
Integration Testing Strategies
Incremental testing strategies:
Bottom-up testing: Integrate individual components in levels until
the complete system is created
Top-down testing: Start with high-level system and integrate from
the top-down replacing individual components by stubs where
appropriate
Outside-in integration: Do bottom-up and top-down testing at the
same time such that the final integration step occurs in a middle layer
Non incremental testing strategies:
Big bang testing: put all together and test it
Remark: In practice, most integration involves a combination of
these strategies
302
Big Bang Integration Testing
simple
Disadvantages:
303
Bottom Up Integration Testing
Idea:Modules at the lowest levels are integrated at first, then by moving
upward through the control structure.
Integration process (five steps):
1. Low-level modules are combined into clusters that perform a specific
software sub-function
2. A driver is written to coordinate test case input and output
3. Test cluster is tested
4. Drivers are removed and clusters are combined moving upward in the
program structure
304
Bottom Up Integration Testing
Pros and cons of bottom-up integration:
no stubs cost
need test drivers
no controllable system until the last step
305
Bottom Up Integration Testing
Stage 4 M11
Integration B Integration c
Stage 3 M9
M10
Integration A
Stage 2 M8
Stage 1 M1 M2 M3 M4 M5 M6 M7
306
Top Down Integration Testing
Idea:
Modules are integrated by moving downward through the control
structure.
Modules subordinate to the main control module are incorporated into
the
system in either a depth-first or breadth-first manner.
307
Integration process (five steps):
1. the main control module is used as a test driver, and the stubs are
substituted
for all modules directly subordinate to the main control module.
2. subordinate stubs are replaced one at a time with actual modules
3. tests are conducted as each module is integrated
4. On completion of each set of tests, another stub is replaced with
the real
module
5. regression testing may conducted
Pros and cons top-down integration:
stub construction cost
major control function can be tested early.
308
Top Down Integration Testing
Integration D
Integration C
Integration B
Integration A
Stage 1 M11
Stage 2 M9 M10
Stage 3 M8
Stage 4 M6 M7
Stage 5 M1 M2
Stage 6 M3 M4 M5
309
Test Stubs and Test Drivers
Top-down testing of module M8 Bottom-up testing of module M8
Module
tested in an Drive
M9 earlier of M9
stage
M8 Module M8 Module
on test on test
Modules
Stub Stub tested in an
of M1 of M2 M1 M2 earlier
stage
310
Regression Testing & Integration
A module firewall:
closure of all possible
affected modules and
in a program based on a
control-flow graph. Main
Reduction of the
4
software regression
testing to a smaller M1 M2 M3
scope (the firewall)
3
This implies that: Changed Module
311
Comparison of the Approaches
Problems of non-incremental integration:
hard to debugging, hard to isolate errors not easy to validate test results
impossible to form an integrated system
Pros and cons top-down integration:
stub construction cost
major control function is tested early
Pros and cons of bottom-up integration:
no stubs cost
need test drivers
no controllable system until the last step
Pros and cons outside-in integration:
stub construction cost
major control function is tested early
need test drivers
312
Architectural validation
Top-down/Outside-in integration testing is better at discovering errors in
the system architecture
System demonstration
Top-down/Outside-in integration testing allows a limited demonstration
at an early stage in the development
Test implementation
Often easier with bottom-up integration testing
Test observation
Problems with all approaches. Extra code may be required to observe
tests
313
III.4.3 Function Testing
The integrated software is tested based on requirements to ensure that
we have a right product (validate functional requirements).
The focus is to uncover errors in:
System input/output
System functions and information data
System interfaces with external parts
User interfaces
System behavior
Function testers: External interfaces
test engineers or SQA people.
User System
interface
User (Operations &
Functions
& Behavior)
314
III.4.4 Performance
Performance testing is designed to test
Testing
Relevant attributes:
run-time performance of software within System process speed
the context of an integrated system (Max./Min./Average)
(validate non-functional requirements).
System throughput
The focus areas are: (Max./Min./Average)
Confirm and validate the specified system System latency
performance requirements. (Max./Min./Average)
Check the current product capacity to System utilization
answer the questions from customers and (Max./Min./Average)
marketing people. System availability
Identify performance issues and (component-level/system-level)
performance degradation in a given System reliability (component-
system level/system-level)
System behavior in the special load System scalability
conditions (component-level/system-level)
System successes/failures rates
Performance testers:
test engineers or SQA people.
315
III.4.5 Acceptance Testing
The system software is tested as a whole. It verifies all elements mesh
properly to make sure that all system functions and performance are
achieved in the target environment.
316
III.4.6 Installation Testing
The installation testing is designed to test the installation procedure
and its supported software.
317
III.5 Management & Automation
Management
Test methodology
Test planning
Test execution
Automation:
Cost effective testing
318
Test Management
Test management encompass:
management of a test team
management of a test process
management of test projects
Management role:
Motivation: Motivate quality work and stimulate creative solutions
Methodology: Test methodology, process, standards, and test criteria
Mechanization/Selection/Development: test tools, configuration
management of test suites, integrated test environment
Measurement: Test cost, complexity and efforts, engineer
performance, test effectiveness, product quality
319
Roles in Testing
A test engineer’s role:
A test manager’s role:
Responsibilities:
Play a leadership role in:
Ensure that testing is
planning projects
performed and documented as
motivating people
defined by the employed
build a team and manage
testing approach
Basic skills:
engineers
Organized; systematic
performance evaluation
planning
Play as a supporter in:
Inner determination to
assist and train engineers
discover
enforce and control test
to the details
Ability to related to others and
resolve conflicts 320
III.5.1 The Testing Process
Phases: Determining the test
(1) Determining the test methodology
methodology phase
Planning the tests
(2) Planning the tests
(3) Test design
Designing the tests
(4) Test implementation
321
(1) Determining the Test
Methodology
Determining the appropriate SQA standard
322
(2) Planning the Test
Scope:
Must address:
a) What to test?
323
a) What to test?
Must address:
Which modules should be unit tested?
Which integrations should be tested?
Determine priorities for allocating test resources
to the individual tasks or applications
Rating:
Damage severity level: estimate the severity of
results in case the module/application fails
Software risk level: probability of failure
324
Damages to Customers and Users
1. Endangers the safety of human beings
2. Affects an essential organizational function with no system
replacement capability available
3. Affects functioning of firmware, causing malfunction of an
entire system
4. Affects an essential organizational function but a
replacement is available
5. Affects proper functioning of software packages for
business applications
6. Affects proper functioning of software packages for a
private customer
7. Affects functioning of a firmware application but without
affecting the entire system.
8. Inconveniences the user but does not prevent accomplishment of the system’s capabilities
325
Damages to the Software Developer
1. Financial losses
malfunctioning of software
systems
2. Non-quantitative damages
326
Issues Affecting Software Risk
Level
Module/application issues
1. Magnitude
2. Complexity and difficulty
3. Percentage of original software (vs. percentage of reused software)
Programmer issues
4. Professional qualifications
5. Experience with the module's specific subject matter.
6. Availability of professional support (backup of
knowledgeable and experience).
7. Acquaintance with the programmer and the ability to
evaluate his/her capabilities.
327
Priorities/Ratings for
Modules/Applications
A = Damage severity level
B = Software risk level
Combined Ratings
C=A+B
C=k*A+m*B
C=A*B (≈Risk = Severity x Probability)
Employ Ratings to:
Assign testing priorities
Allocate resources for testing
Determine required techniques
328
Example: Super Teacher
Combined rating method
Application Damage Software A +B 7xA+2xB AxB
Severity risk
Factor A Factor B
1. Input of test results 3 2 5 (4) 25 (5) 6 (4)
2. Interface for input and output of pupils’ data to 4 8 (1) 36 (1) 16 (1)
4
and from other teachers
3. Preparation of lists of low achievers 2 2 4 (5-6) 18 (7) 4 (5-6)
4. Printing letters to parents of low achievers 1 2 3 (7-8) 11 (8) 2 (8)
5. Preparation of reports for the school principal 3 3 6 (3) 27 (3) 9 (3)
6. Display of a pupil’s achievements profile 4 3 7 (2) 34 (2) 12 (2)
330
Comparison of Test Data Sources
Implication Random Synthetic
Effort Low, especially where expected results High; parameters must be
are available determined and expected
results calculated
Size Relatively high; repetitions are frequent; Relatively small; repetitions
in order to obtain a sufficient number of can be avoided
non-standard situations a relatively large
number is required
Efforts to High efforts (low efficiency) Low effort (high efficiency);
perform tests
Effectiveness Relatively low; Relatively high; due to good
(probability of No coverage of erroneous cases coverage
error detection) Some ability to identify unexpected Good coverage of
errors erroneous situations
Little possibility to identify
unexpected errors
331
c) Who is performing the tests?
Unit test:
developer or tester
Integration test:
developer or tester
System test:
independent tester
Large Systems:
Multiple test teams developer independent tester
Small organizations:
Understands the Must learn about the
Testing by another system but, will system, but, will
development team test “gently ” and, attempt to break it
Outsourcing of testing is driven by and, is driven by
“ delivery ” quality
332
d) Where to perform the tests?
Unit test & Integration test:
Developer site
System test:
Developer Site or target site?
If external tester: consultant site
Simulate target site as good as possible
Still unpredicted failures of the installed system possible!
333
e) When to terminate the tests?
Alternatives:
Approach:
Testing is terminated once:
The entire test plan has been carried out
Error free (“clean”) results have been
achieved for all regression tests
Discussion:
Fits to perfection approach
Disregards budget and timetable constraints
335
ii. Mathematical Model
Application Route
Approach:
A mathematical model is used to estimate the percentage of
undetected errors based on the rate of error detection
Define acceptable level of undetected errors
Determine an abort rate that corresponds to a predefined
level of undetected errors which is considered acceptable
Testing terminates when
The error detection rate declines below the abort rate
336
ii. Mathematical Model
Application Route
Discussion:
The mathematical model may not fully represent the project
characteristics
Simple models provide no estimates about the severity of the undetected
errors
337
iii. Error Seeding Route
Approach:
Errors of various types are seeded (hidden) in the tested
software prior to testing
Assumption: percentage of discovered seeded errors
corresponds to
the percentage of real errors
Define acceptable percentage of undetected errors
Testing terminates when
The residual percentage of undetected seeded errors
declines
below the acceptable percentage
338
iii. Error Seeding Route
Discussion:
Additional workload for tester
Seeding distribution is totally based on past experience while testers
might experience “new and original” errors in every new project
only applicable for similar/familiar systems
339
iv. Dual Independent Testing
Approach:
Team Route
Two teams implement the testing
process independently
detection of errors
acceptable percentage/number
Discussion:
strong assumption
340
v. Termination after Resources
Approach: have petered out …
Testing terminates when
budget or time allocated for testing run out
Discussion:
Undesirable but not uncommon
Systematic follow-up (for all cases):
Data collection about errors detected during development and regular
use (first
6 or 12 month)
Analysis of the error data: compare estimates supplied by the models
with the real figures
Comparative analysis of the severity of errors: Are the errors detected
during
regular use (first 6 or 12 month) more sever than that detected during
development?
341
Software Test Plan (STP) - Template
1 Scope of the tests 3.3 Cross-reference to the relevant design
1.1 The software package to be tested document and the requirement documen
(name, version and revision) 3.4 Test class
3.5 Test level (unit, integration or system
1.2 The documents that provide the basis tests)
for the planned tests 3.6 Test case requirements
2 Testing environment 3.7 Special requirements (e.g.,
2.1 Sites measurements of response times,
security requirements)
2.2 Required hardware and firmware 3.8 Data to be recorded
configuration
2.3 Participating organizations 4 Test schedule (for each test or
2.4 Manpower requirements test group) including time
2.5 Preparation and training required of estimates for:
the test team 4.1 Preparation
4.2 Testing
3 Tests details (for each test) 4.3 Error correction
3.1 Test identification 4.4 Regression tests
3.2 Test objective
342
(3) Test Design
Product of the test design stage:
343
Software Test Description (STD)
1 Scope of the tests
- Template
3. Testing process
1.1 The software package to be tested 3.1 Instructions for input, detailing every
(name, version and revision) step of the input process
1.2 The documents providing the basis 3.2 Data to be recorded during the tests
for the designed tests (name and
version for each document) 4. Test cases (for each case)
2 Test environment (for each test) 4.1 Test case identification details
2.1 Test identification (the test details 4.2 Input data and system settings
are documented in the STP) 4.3 Expected intermediate results (if
2.2 Detailed description of the operating applicable)
system and hardware configuration 4.4 Expected results (numerical,
and the required switch settings for message, activation of equipment,
the tests etc.)
2.3 Instructions for software loading 5. Actions to be taken in case of
program failure/cessation
6. Procedures to be applied
according to the test results
summary
344
(4) Test Implementation
Phase activities:
Testing
Corrections of
detected errors
Re-testing
(regression
testing)
Is the quality of
the software
acceptable?
(Determine
termination)
345
Test Execution
Test execution can be performed:
using manual approach
using a systematic approach
using a semi-automatic approach
Basis activities in test execution are:
Select a test case
Set up the pre-conditions for a test case
Set up test data
Run a test case following its procedure
Track the test operations and results
Monitor the post-conditions of a test case & expect the test
results
Verify the test results and report the problems if there is any
Record each test execution
346
Software Test Report (STR) -
Template
1. Test identification, site, schedule and participation
1.1 The tested software identification (name, version and
revision)
1.2 The documents providing the basis for the tests (name and
version for each document)
1.3 Test site
1.4 Initiation and concluding times for each testing session
1.5 Test team members
1.6 Other participants
1.7 Hours invested in performing the tests
2. Test environment
2.1 Hardware and firmware configurations
2.2 Preparations and training prior to testing
347
III.5.2 Alpha and Beta Site Tests
Programs
Alpha & Beta tests:
348
Pro & Cons of Alpha and Beta
Site Tests
Advantages
Low costs.
Disadvantages
Remark:
349
III.5.3 Test Automation
What is Software Test Automation?
Software test automation refers to the activities and efforts that intend to
automate engineering tasks and operations in a software test process
using well-defined strategies and systematic solutions.
Major objectives:
Reduce software testing time, cost, and efforts
Increase the quality of software testing
Apply well-defined test methods through tools
Relieve the complicated and redundant work from test
engineers
350
Scope of Test Automation
Could be performed in three different scopes:
Enterprise-oriented test automation, where the major
focus of test automation efforts is to automate an
enterprise-oriented test process so that it could be used and
reused to support different product lines and projects in an
organization.
Product-oriented test automation, where test automation
activities are performed to focus on a specific software
product line to support its related testing activities.
Project-oriented test automation, where test automation
effort is aimed at a specific project and its test process.
351
Main Types of Automated Testing
Code auditing
Module size, levels of nesting, levelsof subroutine nesting,
prohibited
constructs (GOTO), check naming conventions, check
programming
styles, check documentation styles, and other forms of
automated
static analysis: unreachable code, …
Test Management
Test plans, test results, and correction follow-up
E.g., Coverage monitoring: collect coverage information
such as
line coverage
Test execution
Functional testing: Automation regression testing; Output comparator
Load testing: Simulate load characteristics
Maintenance follow-up
352
Automated and Manual Testing
by Phase
Testing process phase Automated Manual
testing testing
Test planning M M
Test design M M
Preparing test cases M M
Performance of the tests A M
Preparing the test log and test reports A M
Regression tests A M
Preparing the tests log and test reports M M
including comparative reports
M = phase performed manually,
A= phase performed automatically
353
Maturity Levels of Test Automation
Level 4: Optimal
A systematic solutions to manage test information, execute tests, and generate
tests, and measure test coverage.
Level 3: Automatic
Besides the test management and test execution tools, a
Level 4: Optimal
software test process at this level is supported with additional
solutions to generate software tests using systematic methods.
Systematic Test Level 2: Repeatable
Measurement &
Optimization Level 3:Automatic Also systematic solutions to execute software
Systematic
tests in a systematic manner.
Test Generation Level 2: Repeatable
Systamatic
Level 1: Initial Test Execution
Systematic solutions to Control
Level 1: Initial
create, update, and Systematic Test
manage all types of Information
software test information Management
354
Maturity Levels and
Level 4: Automatic test measurement
Tools test coverage and metrics
measurement
test cost and complexity measurement
Level 3: Automatic test generation
black-box/white-box test generation
Level 2: Automatic test execution
Level 4: Optimal test control and execution
Level 1: Automatic test management
Systematic Test test case management, and
Measurement &
Optimization Level 3:Automatic documentation
test script management
Systematic
Test Generation Level 2: Repeatable
Systematic
Test Execution
Control Level 1: Initial
Systematic Test
Information
Management
355
Essential Needs & Basic Issues
Essential Needs: Basic Issues:
A dedicated work force for
Poor manually performed
test automation software test process
The commitment from Late engagement of
senior managers and software test automation in
engineers a software product life
The dedicated budget and
cycle
project schedule Unrealistic goals and
A well-defined plan and
unreasonable expectations
strategy
Organization issues
Talent engineers and cost-
Lack of good
effective testing tools
understanding and
experience of software test
automation
Maintenance of automated
356
A Software Test Automation Process
Steps:
Test automation planning: identify test
automation focuses, objectives, strategies,
Plan Software requirements, schedule and budget.
Test Automation
Test automation design: draw out the
detailed test automation solutions to
Design Test Automation achieve the major objectives and meet the
Strategies & Solutions
given requirements in a test automation
Select and plan.
Develop & Implement Test
Automation Solutions
Evaluate
Available
Test tool development: realize the test
Software
Testing
automation solutions; the developed tools
Tools must be reliable, usable and reusable
Introduce and Deploy Test
Automation Solutions Test tool deployment: introduce and
deploy the tools; including basic user
Review and Evaluate
training and user support
Software Test Automation Review and evaluation : a review should
be conducted to identify limitations and
evaluate the provided features; valuable
feedback to the test automation group for
further improvements and enhancements. 357
Test Tool Types
Test Tool Types Basic Descriptions of Different Types of Test Tools
Test Information Systematic solutions and tools support test engineers and quality
Management assurance people to
create, update, and maintain diverse test information, including test
cases, test scripts,
test data, test results, and discovered problems.
Test Execution and Systematic solutions and tools help engineer set up and run tests, and
Control collect and
validate test results.
Test Generation Systematic solutions and tools generate program tests in an automatic
way.
Test Coverage Analysis Systematic solutions and tools analyze the test coverage during a test
process based
on selected test criteria.
Performance Testing Systematic solutions and tools support program performance testing and
and performance
Measurement measurement.
Software Simulators Programs are developed to simulate the functions and behaviors of
external systems,
or dependent subsystems/components for a under test program.
Regression Testing Test tools support the automation performance of regression testing and
activities,
including test recording and re-playing.
358
Classification of Software Test Tools
There are three types of test information
management systems and tools.
Test information management tool: It supports engineers to create, update,
and
manage all types of test information, such as testing requirements, test cases,
data, procedures, and results.
Test suite management tool: It enables engineers to create, update, and
manage various software test scripts for test execution.
Problem management tool: It helps engineer
bookkeeping and manage the discovered problems during a test process.
There are three types of software simulators:
Model-driven program simulators: based on a specific model, such as a finite
state machine
Data-driven program simulators: functional program based on the given
inputs and return the pre-defined outputs.
Message-driven program simulators: communication process to generate
outgoing messages, based on the pre-defined incoming messages.
359
Regression test tools:
Software change analysis: This refers to a systematic facility that
identifies various types of software changes and discovers their ripple effects
and impacts.
Software test selection: This refers to a systematic facility that assists
engineers to select reusable tests for regression testing based on software
change information.
Test change analysis: This refers to a systematic solution that identifies the
necessary test changes based on the given software changes. The major task of
test change analysis is to find reusable tests and identify obsolete tests so that
new tests could be added, and existing tests will be updated.
Test recorder and re-player: This refers to a software tool that records the
executed tests, and re-plays them for re-testing. Mercury
Interactive’s Winrunner is a typical re-testing
tool that is able to record and re-play user-
system interactive sequences for window-
based programs using pre-defined test scripts.
360
Classification of Software Test Tools
Types of Test Tools Test Tool Vendors Test Tools
Problem Management Tools Rational Inc. ClearQust, ClearDDTS
Microsoft Corp. PVCS Tracker
Imbus AG Imbus Fehlerdatenbank
Test Information Management Tools Rautional Inc. TestManager
Mercury Interactive TestDirectory
Test Suite Management Tools Evalid TestSuiter
Rational Inc. TestFactory
SUN JavaTest, JavaHarness
White-Box Test Tools McCabe & Associates McCabe IQ2
Junit
IBM IBM COBOL Unit Tester
IBM ATC
- Coverage Assistant
- Source Audit Assistant
- Distillation Assistant
- Unit Test Assistant
361
Classification of Software Test Tools
Test Execution Tools OC Systems Aprob
Softbridge ATF/TestWright
AutoTester AutoTester
Rational Inc. Visual Test
SQA Robot
Mercury Interactive WinRunner
Sterling Software Vision TestPro
Compuware QARun
Seque Software SilkTest
RSW Software Inc. e-Test
Cyrano Gmbh Cyrano Robot
Code Coverage Analysis Tools Case Consult Corp. Analyzer, Analyzer Java
OC Systems Aprob
IPL Software Product Group Cantata/Cantata++
Compuware QA-Load
Mercury Interactive LoadRunner
RSW Software Inc. e- Load
SUN JavaLoad
Seque Software SilkPerformer
Client/Server Solutions, Inc. Benchmark Factory
Regression Testing Tools IBM Regression Testing Tool(ARTT)
Distillation Assistant
GUI Record/Replay Software Research eValid
Mercury Interactive Xrunner
Astra Astra QuickTest
AutoTester AutoTester, AutoTester One
363
Automated Testing
Advantages
Reduce manual software testing operations and eliminate redundant
testing efforts.
Few manpower resources required for performing of tests.
Shorter duration of testing.
Execute much more software tests and achieve a better testing
coverage in a very limited schedule.
Accuracy and completeness of performance.
Accuracy of results log and summary reports.
Comprehensiveness of information.
Produce more systematic repeatable software tests, and generate more
consistent testing results.
Performance of complete regression tests.
Performance of test classes beyond the scope of manual testing.
364
Automated Testing
Disadvantages
High investments required in package purchasing and training.
High package development investment costs.
High manpower requirements for test preparation.
Considerable testing areas left uncovered.
365
III.6 Paradigm & Domain
Specific Aspects
Paradigms: object-oriented, component-
based, agent-oriented, …
Testing of systems which apply object-
oriented technologies (OOA/OOD/OOP/…)
366
III.6.1 Testing Object-Oriented
Systems
Relatively little attention has been paid to considerations for testing OO implementations
Lack of attention is not lack of need; New opportunities for error come with the increased
power of OO languages:
each lower level in an inheritance hierarchy is a new context for inherited features
correct behavior at an upper level in no way guarantees behavior at a lower level
polymorphism with dynamic binding dramatically increases the number of execution
paths static analysis of source code is of relatively little help with these
situations
encapsulation is an obstacle to controllability and operability of implementation state
367
OO & Unit Testing
Unit of testing in OO context:
software
behavior of class
368
OO Testing: Easier vs. Harder
Easier
Modularity Inheritance Harder
Quicker
Polymorphism
development
Dynamic
Encapsulation binding
Small methods
Complex
Reuse interfaces
Interfaces
identified More integration
early
369
Class Testing & States
Functional
model of
processing
OO model of
processing
Polymorphism
object
371
Object-Oriented Testing Issues
The object class is the basic testing unit for
design.
372
Levels of Testing
1. Testing individual methods associated with objects:
black-box and white-box testing
2. Testing individual object classes:
black-box testing with “equivalence class” testing extended to
cover related operation sequences
structural (white-box) testing (requires a different type of analysis)
3. Testing clusters of objects :
strict top-down/bottom-up iteration inappropriate to create groups
or related groups explicit clustering
scenario-based testing appropriate
4. Testing the object-oriented system:
verification/validation against system requirements is carried out
as for any other type of system
373
Class Testing (1/2)
is usually meaningless
374
Class Testing (2/2)
To test a class, you may need instances
of other classes.
375
Method Testing (1/2)
376
Method Testing (2/2)
377
Incremental Testing
Incremental testing indicates that we test each
an increment integration.
Classes in a package
use case.
378
A Class Test Order for OO Programs
3
4
4.1 ButtonList Sensor
AG 3.4
AS AS
AG 3.3
AS
AS
AS
4.2 Event Scene
Button
AS I 3.1
AS
I 2
ButtonState AG
3 TextButton 3.2 World I
AS
AS
AS
I
1 I 1 2
1.1 5.2 I
Subject Control CanvasRep Canvas
AS
I
AS
AS AS AS
MonoScene
379
Integration Test Plan
An Integration Test checks and verifies that the
various components in a class cluster
communicate properly with each other.
With this plan, the emphasis is not on whether
system functionality is correctly implemented,
but rather do all the cluster classes “fit” together
properly.
A single test plan, for each cluster, which tests
the communication between all cluster
components is typically sufficient.
380
Increment Test Planning
Determine the classes to be tested in an
increment.
class.
381
III.6.1 Testing Embedded Systems
Development Stages
Simulation
Prototyping
Pre-Production
Production
382
What is an Embedded System?
Software
embedded into a
technical
system that
interacts with the
real physical
world, controlling
some specific
hardware.
Interaction with 383
What is the Correct Behavior?
Continuous and discrete
signals in the
Time domain
Value domain
Exact match is not realistic
tolerance in
value and time
384
Different Development Stages
(1) Simulation
(2) Prototyping
(3) Pre-Production
(4) Production
385
(1) Simulation
One-way simulation (model test)
Test plant or embedded
software model
Feedback-simulation (model-in-the-loop)
Let the models of the plant and the
embedded software interact
Rapid Prototyping
Let the “real” plant (or a
simplified version) interact
with the model of the
embedded software (on
high performance hardware;
floating-point arithmetic)
386
(2) Prototyping (1/3)
(1) Embedded software
Compiled for host
Compiled for target
platform
(2) Processor
High performance host
Target platform
emulator
(3) Rest of the embedded
system
Simulated on the host
Experimental hardware
platform
Prototype hardware
platform
(4) Plant
Statically (signal
generator)
Dynamically
(simulation model)
387
Prototyping (2/3)
(1) Software unit and software
integration test
Same environment as MIL
Final software instead of model
a) Host environment
b) Target (emulator)
(2) Hardware/software
integration
test
Test hardware integration
Signal processors
388
Prototyping (3/3)
(3) System integration test
Integrate all hardware parts (often prototypes)
Similar to hardware integration (but complete!)
(4) Environmental test
Measuring influence of the system on the environment (EMC)
Measuring roboustness of the system w.r.t. environment
conditions (temperature, humidity, EMI, shock or vibration, …)
389
(3) Pre-Production
Applicable tests:
Test a pre-production unit
Use pre-production unit Acceptance test
Execute with the real plant Qualification test
Safety execution test
Goals: Test of the production and
Prove that all requirements are maintenance
met test facilities
Demonstrate conformity with Inspection and/or test by government
officials
relevant
standards/norms Typical test techniques:
Demonstrate that production Real-life testing
effort and schedule can be met Random testing
Demonstrate maintainability Fault injection
and mean- time-to-repair Remark:
requirements Special tools for gathering and
Demonstrate product to recording
(potential) the data as well as fault injection are
customers required
Often environment test facilities
(climate
chambers, vibration tables, …) are also
used 390
(4) Production
391
Comparison of the Test Levels
392
III.7 Discussion & Summary
Besides dynamic analysis (testing), which includes the execution of
the software, also effective manual static analysis techniques such as
reviews or inspections are available.
Automatic or semi-automatic static analysis techniques are static
code analysis, formal methods, or model checking.
Two main approaches to testing (dynamic analysis) are black box
testing, which ignores the internal mechanism of the system or
component (sometimes named functional testing), or white box
testing, which takes into account the internal mechanism of a system
or component (sometimes named structural testing).
The testing activities during development should include, unit tests,
integration tests, and system tests. System tests may be divided into
function tests, performance tests, acceptance tests, and installation
tests.
393
III.7 Discussion & Summary
Test management should result in a testing process which includes (1)
determining the test methodology, (2) planning the tests, (3) design the
individual tests, and (4) implement the designed tests.
The criteria when to terminate the tests is of critical importance.
Mathematical models, error seeding, or dual independent testing teams
are available approaches to guide termination.
Test automation can help to reduce software testing time, cost, and
efforts while increase the quality of software testing by applying well-
defined test methods through tools. Systematically employed can they
relieve some complicated and redundant work from test engineers.
The paradigm employed for the system development is relevant for
testability: e.g., object-oriented systems have advantages as well as
drawbacks w.r.t. testing
The application domain is relevant for the required testing: e.g.,
embedded systems and their software must be subject to a whole series
of test configurations
394
Software Configuration
Management
395
Outline
396
What is SCM?
• Change management is commonly called software
configuration management (SCM or CM)
397
What is SCM? (Contd.)
398
Difference between Software
Support and SCM
• Support is a set of s/w engg. activities that occur
after software has been delivered to the customer
and put into operation.
399
What is software configuration?
• The items that comprise all information produced
as part of the software process are collectively
called a software configuration
• This information (also termed as output of software
process) is broadly divided into:
• Computer programs (both source level & executable
forms)
• Work products that describe the computer programs
• Data (contained within program or external to it)
400
Sources of Changes
401
People involved in a typical SCM
Scenario
• Project Manager
• In charge of s/w group
• Ensures that product is developed within time frame
• Monitors development, recognizes & reacts to problems
• by generating & analyzing reports about system status
• By performing reviews
• Configuration Manager
• In charge of CM procedures
• Ensures that procedures & policies for creating, changing &
testing of code are followed
• To control changes in code, introduces mechanisms for official
change requests, their evaluation & authoriza-tion.
402
People involved in a typical SCM
Scenario
• Software engineers
• Work efficiently without interfering in each other’s code
creation, testing & supporting documentation.
• But at the same time communicate & coordinate efficiently by
• Updating each other about tasks required & tasks completed
• Propagating changes across each others work by merging files
• Customers
• Use the product
• Follows formal procedures of requesting changes and for
indicting bugs in the product
403
Baselines
404
Baselined SCIs and Project DB
Modified SCIs
PROJECT DB
Stored SCIs
405
Configuration Objects
406
SCM Repository
408
SCM Process
409
Version Control
• 2. Version Definition: A specific instance or revision of an entity that results from changes made over time.
• Key Idea: Tracks the evolution of the entity through modifications.
• Example: main.c (Entity) →
• Version 1: Initial implementation of main.c.
• Version 2: Added a new function to main.c.
• Version 3: Fixed a bug in main.c.
411
Change Control
• A Change request is submitted and evaluated to
assess technical merit and impact on the other
configuration objects and budget
• Change report contains the results of the evaluation
• Change control authority (CCA) makes the final
decision on the status and priority of the change
based on the change report
• Engineering change order (ECO) is generated for each
change approved (describes change, lists the
constraints, and criteria for review and audit)
412
Change Control (Contd.)
413
Software Configuration Audit
414
Configuration Status Reporting
415
Chapter 25
Risk Management
- Introduction
- Risk identification
- Risk projection (estimation)
- Risk mitigation, monitoring, and
management
416
(Source: Pressman, R. Software Engineering: A Practitioner’s Approach. McGraw-Hill, 2005)
Project Risks
417
Introduction
418
What Is Software Risk?
419
Types of software risks
• Software risk exists because the future is uncertain and there are
many known and unknown things that cannot be incorporated in the
project plan.
• A software risk can be of two types
• (1) internal risks that are within the control of the project manager and
• (2) external risks that are beyond the control of project manager.
420
Definition of Risk
• A risk is a potential problem – it might happen and it might not
• Conceptual definition of risk
• Risk concerns future happenings
• Risk involves change in mind, opinion, actions, places, etc.
• Risk involves choice and the uncertainty that choice entails
• Two characteristics of risk
• Uncertainty – the risk may or may not happen, that is, there are no 100%
risks (those, instead, are called constraints)
• Loss – the risk becomes a reality and unwanted consequences or losses
occur
421
Risk Categorization – Approach #1
• Project risks
• They threaten the project plan
• If they become real, it is likely that the project schedule will slip and that
costs will increase
• Technical risks
• They threaten the quality and timeliness of the software to be produced
• If they become real, implementation may become difficult or impossible
• Business risks
• They threaten the viability of the software to be built
• If they become real, they jeopardize the project or the product
423
Risk Categorization – Approach #2
• Known risks
• Those risks that can be uncovered after careful evaluation of the project plan,
the business and technical environment in which the project is being
developed, and other reliable information sources (e.g., unrealistic delivery
date)
• Predictable risks
• Those risks that are extrapolated from past project experience (e.g., past
turnover)
• Unpredictable risks
• Those risks that can and do occur, but are extremely difficult to identify in
advance
424
Reactive vs. Proactive Risk
Strategies
426
Steps for Risk Management
427
Steps for Risk Management
428
Risk Identification
429
Background
• Risk identification is a systematic attempt to specify threats to the
project plan
• By identifying known and predictable risks, the project manager takes a
first step toward avoiding them when possible and controlling them
when necessary
• Generic risks
• Risks that are a potential threat to every software project
• Product-specific risks
• Risks that can be identified only by those a with a clear understanding of
the technology, the people, and the environment that is specific to the
software that is to be built
• This requires examination of the project plan and the statement of scope
• "What special characteristics of this product may threaten our project
plan?"
430
Risk Item Checklist
432
Recording Risk Information
433
Questionnaire on Project Risk
(Questions are ordered by their relative importance to project success)
7) Does the software engineering team have the right mix of skills?
8) Are project requirements stable?
9) Does the project team have experience with the technology to be
implemented?
10) Is the number of people on the project team adequate to do the
job?
11) Do all customer/user constituencies agree on the importance of
the project and on the requirements for the system/product to be
built?
435
Risk Components and Drivers
• Risk Component: refer to the key elements that make up a risk, such as the risk event, its
likelihood, impact, and potential consequences.
• Risk Driver: are the underlying factors or causes that influence the occurrence or
magnitude of a risk, such as resource availability, market conditions, or technological
changes.
• The project manager identifies the risk drivers that affect the following risk components
• Performance risk - the degree of uncertainty that the product will meet its requirements and be fit
for its intended use
• Cost risk - the degree of uncertainty that the project budget will be maintained
• Support risk - the degree of uncertainty that the resultant software will be easy to correct, adapt,
and enhance
• Schedule risk - the degree of uncertainty that the project schedule will be maintained and that the
product will be delivered on time
• The impact of each risk driver on the risk component is divided into one of four impact
levels
• Negligible, marginal, critical, and catastrophic
• Risk drivers can be assessed as impossible, improbable, probable, and frequent
436
Risk Projection
(Estimation)
437
Background
• Risk projection (or estimation) attempts to rate each risk in two ways
• The probability that the risk is real
• The consequence of the problems associated with the risk, should it occur
• The project planner, managers, and technical staff perform four risk
projection steps (see next slide)
• The intent of these steps is to consider risks in a manner that leads to
prioritization
• By prioritizing risks, the software team can allocate limited resources
where they will have the most impact
438
Risk Projection/Estimation Steps
439
Contents of a Risk Table
• A risk table provides a project manager with a simple technique for risk
projection
• It consists of five columns
• Risk Summary – short description of the risk
• Risk Category – one of seven risk categories (slide 17)
• Probability – estimation of risk occurrence based on group input
• Impact – (1) catastrophic (2) critical (3) marginal (4) negligible
• RMMM – Pointer to a paragraph in the Risk Mitigation, Monitoring, and
Management Plan
• List all risks in the first column (by way of the help of the risk item
checklists)
• Mark the category of each risk
• Estimate the probability of each risk occurring
• Assess the impact of each risk based on an averaging of the four risk
components to determine an overall impact value (See next slide)
• Sort the rows by probability and impact in descending order
• Draw a horizontal cutoff line in the table that indicates the risks that
will be given further attention
441
Assessing Risk Impact
• Three factors affect the consequences that are likely if a risk does occur
• Its nature – This indicates the problems that are likely if the risk occurs
• Its scope – This combines the severity of the risk (how serious was it) with its
overall distribution (how much was affected)
• Its timing – This considers when and for how long the impact will be felt
• The overall risk exposure formula is RE = P x C
• P = the probability of occurrence for a risk
• C = the cost to the project should the risk actually occur
• Example
• P = 80% probability that 18 of 60 software components will have to be
developed
• C = Total cost of developing 18 components is $25,000
• RE = .80 x $25,000 = $20,000
442
Risk Mitigation, Monitoring,
and Management
443
Background
• An effective strategy for dealing with risk must consider three issues
(Note: these are not mutually exclusive)
• Risk mitigation (i.e., avoidance)
• Risk mitigation: refers to the process of identifying, assessing, and implementing strategies to
reduce the likelihood or impact of potential risks on a project or organization. This involves taking
proactive steps to avoid, minimize, or control risks, ensuring the project's objectives are achieved
with minimal disruption.
• Implementing regular code reviews and automated testing to catch bugs early in a software
development project. This reduces the risk of deploying faulty code into production.
• Risk monitoring
• Risk management and contingency planning
• risk contingency planning prepares for a response if the risk happens despite efforts to mitigate it.
• Having backup personnel or contractors available to step in if key team members become
unavailable due to illness, resignation, or other reasons. This ensures that the project can continue
smoothly even if someone leaves the team.
• Risk mitigation (avoidance) is the primary strategy and is achieved through
a plan
• Example: Risk of high staff turnover (see next slide)
445
Background (continued)
• During risk monitoring, the project manager monitors factors that may
provide an indication of whether a risk is becoming more or less likely
• Risk management and contingency planning assume that mitigation
efforts have failed and that the risk has become a reality
• RMMM steps incur additional project cost
• Large projects may have identified 30 – 40 risks
• Risk is not limited to the software project itself
• Risks can occur after the software has been delivered to the user
447
The RMMM Plan
448
Seven Principles of Risk Management
Maintain a global perspective
View software risks within the context of a system and the business problem that is intended to
solve
450
451