0% found this document useful (0 votes)
73 views

Chapter 7 Software Verification and Validation

The document discusses software verification and validation (V&V) techniques. It defines verification as ensuring a product is built correctly, and validation as ensuring the right product is built. Key V&V techniques discussed are inspections, static analysis, testing, and debugging. Inspections involve examining requirements, design or code to find defects without executing the system. Static analysis uses tools to automatically check code for potential errors. Together, inspections and testing provide complementary verification by checking static representations and dynamic behavior. The goal of V&V is to establish confidence a software system is fit for purpose.

Uploaded by

melsew
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views

Chapter 7 Software Verification and Validation

The document discusses software verification and validation (V&V) techniques. It defines verification as ensuring a product is built correctly, and validation as ensuring the right product is built. Key V&V techniques discussed are inspections, static analysis, testing, and debugging. Inspections involve examining requirements, design or code to find defects without executing the system. Static analysis uses tools to automatically check code for potential errors. Together, inspections and testing provide complementary verification by checking static representations and dynamic behavior. The goal of V&V is to establish confidence a software system is fit for purpose.

Uploaded by

melsew
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Chapter 5

Software Verification and Validation

1
Objectives
l To introduce software verification and validation
and to discuss the distinction between them
l To describe the program inspection process and
its role in V & V
l To explain static analysis as a verification
technique

2
Topics covered
l Verification and validation planning
l Software inspections
l Automated static analysis
l Cleanroom software development

3
Verification vs validation
l Verification:
 “Are we building the product right”
 The software should conform to its
specification
l Validation:
 "Are we building the right product“
 The software should do what the user really
requires

4
The V & V process
l Is a whole life-cycle process - V & V must
be applied at each stage in the software
process.
l Has two principal objectives
 The discovery of defects in a system
 The assessment of whether or not the system is
usable in an operational situation.

5
Static and dynamic verification
l Software inspections Concerned with analysis
of the static system representation to discover
problems (static verification)
 May be supplement by tool-based document and code analysis
l Software testing Concerned with exercising and
observing product behaviour (dynamic
verification)
 The system is executed with test data and its operational
behaviour is observed

6
V& V goals
l Verification and validation should establish
confidence that the software is fit for
purpose
l This does NOT mean completely free of
defects
l Rather, it must be good enough for its
intended use and the type of use will
determine the degree of confidence that is
needed
7
8
Testing and debugging
l Defect testing and debugging are distinct
processes
l Verification and validation is concerned with
establishing the existence of defects in a
program
l Debugging is concerned with locating and
repairing these errors
l Debugging involves formulating a hypothesis
about program behaviour then testing these
hypotheses to find the system error
9
The debugging process

Test Test
results Specification
cases

Locate Design Repair Re-test


error error repair error program

10
V & V planning
l Careful planning is required to get the most out
of testing and inspection processes
l Planning should start early in the development
process
l The plan should identify the balance between
static verification and testing
l Test planning is about defining standards for the
testing process rather than describing product
tests

11
The structure of a software test plan
l The testing process
l Requirements traceability
l Tested items
l Testing schedule
l Test recording procedures
l Hardware and software requirements
l Constraints

12
Software inspections
l Involve people examining the source
representation with the aim of discovering
anomalies and defects
l Do not require execution of a system so may be
used before implementation
l May be applied to any representation of the
system (requirements, design, test data, etc.)
l Very effective technique for discovering errors

13
Inspection success
l Many different defects may be discovered
in a single inspection. In testing, one defect
,may mask another so several executions
are required.
l The reuse domain and programming
knowledge so reviewers are likely to have
seen the types of error that commonly
arise.

14
Inspections and testing
l Inspections and testing are complementary and
not opposing verification techniques
l Both should be used during the V & V process
l Inspections can check conformance with a
specification but not conformance with the
customer’s real requirements
l Inspections cannot check non-functional
characteristics such as performance, usability,
etc.

15
Program inspections
l Formalised approach to document reviews
l Intended explicitly for defect DETECTION (not
correction)
l Defects may be logical errors, anomalies in the
code that might indicate an erroneous condition
(e.g. an uninitialised variable) or non-compliance
with standards

16
Inspection pre-conditions
l A precise specification must be available
l Team members must be familiar with the
organisation standards
l Syntactically correct code must be available
l An error checklist should be prepared
l Management must accept that inspection will
increase costs early in the software process
l Management must not use inspections for
staff appraisal

17
The inspection process

Planning
Overview Follow-up
Individual
Rework
preparation
Inspection
meeting

18
Inspection procedure
l System overview presented to inspection team
l Code and associated documents are
distributed to inspection team in advance
l Inspection takes place and discovered errors
are noted
l Modifications are made to repair discovered
errors
l Re-inspection may or may not be required

19
Inspection teams
l Made up of at least 4 members
l Author of the code being inspected
l Inspector who finds errors, omissions and
inconsistencies
l Reader who reads the code to the team
l Moderator who chairs the meeting and notes
discovered errors
l Other roles are Scribe and Chief moderator

20
Inspection checklists
l Checklist of common errors should be used to
drive the inspection
l Error checklist is programming language
dependent
l The 'weaker' the type checking, the larger the
checklist
l Examples: Initialisation, Constant naming, loop
termination, array bounds, etc.

21
Fault class Inspection check
Data faults Are all program variables initialis ed before their values
are used?
Have all cons tants been named?
Should the lower bound of arrays be 0, 1, or something
els e?
Should the upper bound of arrays beequal to the s ize of
the array or Size -1?
If character strings are used, is a delimiter explicitly
as signed?
Control faults For each conditional statement, is the condition correct?
Is each loop certain to terminate?
Are compound statements correctly bracketed?
In case statements, are all poss ible cas es accounted for?
Input/output faults Are all input variables used?
Are all output variables ass igned a value before they are
output?
Interface faults Do all function and procedure calls have the correct
number of parameters?
Do formal and actual parameter types match?
Are the parameters in the right order?
If components access shared memory, do they have the
same model of the shared memory structure?
Storage management If a linked structure is modified, have all links been
faults correctly reas signed?
If dynamic storage is us ed, has space been allocated
correctly?
Is space explicitly de-allocated after it is no longer
required?
Exception Have all pos sible error conditions been taken into Inspection checks
management faults account?
Inspection rate
l 500 statements/hour during overview
l 125 source statement/hour during individual
preparation
l 90-125 statements/hour can be inspected
l Inspection is therefore an expensive process
l Inspecting 500 lines costs about 40 man/hours
effort = £2800

23
Automated static analysis
l Static analysers are software tools for source
text processing
l They parse the program text and try to discover
potentially erroneous conditions and bring these
to the attention of the V & V team
l Very effective as an aid to inspections. A
supplement to but not a replacement for
inspections

24
Static analysis checks
Fault class Static analys is check
Data faults Variables us ed before initialisation
Variables declared but never us ed
Variables as signed twice but never used
between assignments
Possible array bound violations
Undeclared variables
Control faults Unreachable code
Unconditional branches into loops
Input/output faults Variables output twice with no intervening
as signment
Interface faults Parameter type mismatches
Parameter number mismatches
Non-usage of the results of functions
Uncalled functions and procedures
Storage management Unassigned pointers
faults Pointer arithmetic

25
Stages of static analysis
l Control flow analysis. Checks for loops with
multiple exit or entry points, finds unreachable
code, etc.
l Data use analysis. Detects uninitialised
variables, variables written twice without an
intervening assignment, variables which are
declared but never used, etc.
l Interface analysis. Checks the consistency of
routine and procedure declarations and their
use
26
Stages of static analysis
l Information flow analysis. Identifies the
dependencies of output variables. Does not
detect anomalies itself but highlights
information for code inspection or review
l Path analysis. Identifies paths through the
program and sets out the statements
executed in that path. Again, potentially
useful in the review process
l Both these stages generate vast amounts of
information. Must be used with care.
27
Use of static analysis
l Particularly valuable when a language such as C
is used which has weak typing and hence many
errors are undetected by the compiler
l Less cost-effective for languages like Java that
have strong type checking and can therefore
detect many errors during compilation

28
Formal specification and inspections
l The state based model is a system specification
and the inspection process checks the program
against this model
l Programming approach is defined so that the
correspondence between the model and the
system is clear
l Mathematical arguments (not proofs) are used to
increase confidence in the inspection process

29
Key points
l Verification and validation are not the same
thing. Verification shows conformance with
specification; validation shows that the program
meets the customer’s needs
l Test plans should be drawn up to guide the
testing process.
l Static verification techniques involve examination
and analysis of the program for error detection

30
Key points
l Program inspections are very effective in
discovering errors
l Program code in inspections is checked by a
small team to locate software faults
l Static analysis tools can discover program
anomalies which may be an indication of faults in
the code

31

You might also like