Software Verification
Software Verification
Content of Lecture
• Defect Prevention
• Defect Containment
• Formal methods
• Product and domain specific knowledge: If the people involved are not familiar with the
product type or application domain, there is a good chance that wrong solutions will be
implemented. For example, developers unfamiliar with embedded software may design
software without considering its environmental constraints, thus leading to various interface
and interaction problems between software and its physical surroundings.
• General software development knowledge and expertise: Plays an important role in developing
high-quality software products. For example, lack of expertise with requirement analysis and
product specification usually leads to many problems and rework in subsequent design, coding,
and testing activities.
• Knowledge about the specific development methodologies and tools Used by the organization
also plays an important role in developing high-quality software products. For example, in an
implementation of Clean room technology (Mills et al., 1987b), if the developers are not familiar
with the key components of formal verification or statistical testing, there is little chance for
producing high-quality products.
• Knowledge about the software process used by the organization: If the project personnel do
not have a good understanding of the development process involved, there is little chance that
the process can be implemented correctly. For example, if the people involved in incremental
software development do not know how the individual development efforts for different
increments fit together, the uncoordinated development may lead to many interface or
interaction problems.
Formal Methods
• Formal methods provide a way to eliminate certain error sources and to verify the
absence of related faults
• Include formal specification and formal verification
• In Formal specification, an unambiguous set of product specifications given so that
customer requirements, as well as environmental constraints and design intentions, are
correctly reflected, thus reducing the chances of accidental fault injections
• Formal verification checks the conformance of software design or code against these
formal specifications, thus ensuring that the software is fault-free with respect to its
formal specifications
A better managed process can also eliminate many systematic problems. For example, not
having a defined process or not following it for system configuration management may lead
to inconsistencies or interface problems among different software components.
Ensuring appropriate process definition and conformance helps eliminate some such error
sources. Similarly, enforcement of selected standards for certain types of products and
development activities also reduces fault injections
Sometimes, specific software tools can also help reduce the chances of fault injections. For
example, a syntax-directed editor that automatically balances out each open parenthesis,
“{”, with a close parenthesis, “}”, can help reduce syntactical problems in programs written
in the C language
Defect Reduction
• Inspection
• Testing
• Other techniques
Defect Reduction
• Software inspections are critical examinations of software artifacts by
human inspectors aimed at discovering and fixing faults in the software
systems.
• Inspection is a well-known QA alternative familiar to most experienced
software quality professionals. The earliest and most influential work in
software inspection is Fagan inspection (Fagan, 1976).
• Various other variations have been proposed and used to effectively
conduct inspection under different environments
Inspection :
• Inspections are critical reading and analysis of software code or other
software artifacts, such as designs, product specifications, test plans, etc.
• Inspections are typically conducted by multiple human inspectors, through
some coordination process. Multiple inspection phases or sessions might be
used.
• Faults are detected directly in inspection by human inspectors, either during
their individual inspections or various types of group sessions.
• Identified faults need to be removed as a result of the inspection process,
and their removal also needs to be verified.
• The inspection processes vary, but typically include some planning and follow-up activities in
addition to the core inspection activity.
• The formality and structure of inspections may vary, from very informal reviews and
walkthroughs.
• Informal reviews:
• Formal inspections:
• Fagan inspection
• Gilb inspection
• Establishment and evaluation of a framework for performing software inspections based on Tom
Gilb's inspection method, covering all development phases and work products
• Inspection is most commonly applied to code, but it could also be applied to requirement
specifications, designs, test plans and test cases, user manuals, and other documents or
software artefacts
• Inspection can be used throughout the development process, particularly early in the software
development before anything can be tested
• Another important potential benefit of inspection is the opportunity to conduct causal analysis
during the inspection process, for example, as an added step in Gilb inspection these causal
analysis results can be used to guide defect prevention activities by removing identified error
sources or correcting identified missing/incorrect human actions.
Testing
• Testing is one of the most important parts of QA and the most commonly performed QA activity.
• Testing involves the execution of software and the observation of the program behaviour or
outcome
• If a failure is observed, the execution record is then analyzed to locate and fix the fault(s) that
caused the failure
When can a specific testing activity be performed and related faults be detected
• When black-box testing is performed, failures related to specific external functions can
be observed, leading to corresponding faults being detected and removed. The
emphasis is on reducing the chances of encountering functional problems by target
customers.
The emphasis is on reducing internal faults so that there is less chance for failures later on no matter
what kind of application environment the software is subjected to
• Coverage information (higher coverage information means higher quality or lower levels
of defects)
• Checklists are used to make containing major functions and usage scenarios are
tested before product release
• Product reliability goals can be used as a more objective criterion to stop testing.
Defect Containment
• Due to large size and high complexity of most software systems, the defect
reduction activities can only reduce the number of faults to a fairly low
level, but not completely eliminate them.
• For software systems where failure impact is substantial, such as many real-
time control software sub-systems used in medical, nuclear, transportation,
and other embedded systems, this low defect level and failure risk may still
be inadequate.
Fault Tolerance
• Software fault tolerance ideas originate from fault tolerance designs in
traditional hardware systems that require higher levels of reliability and
availability
• The primary software fault tolerance techniques include recovery blocks, N-
version programming (NVP), and their variations
• Recovery blocks use repeated executions (or redundancy over time) as the
basic mechanism for fault tolerance. If dynamic failures in some local areas
are detected, a portion of the latest execution is repeated, in the hope that
this repeated execution will not lead to the same failure. Therefore, local
failures will not propagate to global failures, although some time-delay may
be involved.
• NVP uses parallel redundancy, where N copies, each of a different version,
of programs fulfilling the same functionality are running in parallel. The
decision algorithm in NVP makes sure that local failures in limited number
of these parallel versions will not compromise global execution results
Content of Lecture
• Handling Discovered Defect During QA Activities
• QA Activities in Software Processes
• Verification and Validation Perspectives
• Reconciling the Two Views
Introduction
• Quality assurance (QA) interpretation from last lecture
• QA as dealing with defects
• implicitly assumed that all discovered defects will be resolved within the
software development process before product release
• In this lecture we
• Describe defect handling during the execution of specific QA activities
• Examine how different QA activities fit into different software development
processes
• Examine the QA activities from the perspective of verification and validation
(V&V) view
Defect Handling and Related Activities
• QA aims to resolve each discovered defect before product release
• Most important activity associated with defect handling is defect resolution
• Ensures that each discovered defect is corrected or taken care of through
appropriate actions
• Two important activities to support defect resolution:
• Defect logging: recording discovered defects
• Defect tracking: monitoring defects up its final resolution
• What to record?
• Various specific information can be recorded and updated through the defect
handling process. Defect type, severity, impact areas, possible cause etc
• Details in later lectures
• To ensure proper collection and usage of defected data, we need to pay special
attention to the following in the defect discovery and resolution activities
• distinguish execution failures, internal faults and human errors
• the specific problems need to be counted and tracked consistently
• timely defect reporting
Defect Handling Process
• Defect handling handled in similar ways as configuration management
• A formalized defect handling process defines
• Important activities and associated rules,
• Parties involved, and their responsibilities
• Multiple parties.
• Different states associated with individual defect status
• New, Working, Closed
Defect Handling Tools
Examples Cont’d
If I click the left button on, does it disable the far right switch?
(validation)
If I click the left button off, does it enable the far right switch?
(validation)
If I click the right button on, does it disable the far left switch?
(validation)
If I click the right button off, does it enable the far left switch?
(validation)
If I click both buttons on does only the middle switch work?
(validation)
The V & V process
• Is a whole life-cycle process - V & V must be applied at each stage in the software
process.
• Has two principal objectives
• The discovery of defects in a system;
• The assessment of whether or not the system is useful and useable in an
operational situation.
V & V goals
• Verification and validation should establish confidence that the software is fit for
purpose.
• This does NOT mean completely free of defects.
• Rather, it must be good enough for its intended use and the type of use will determine
the degree of confidence that is needed.
V & V confidence
• Depends on system’s purpose, user expectations and marketing environment
• Software function
• The level of confidence depends on how critical the software is to an
organisation.
• User expectations
• Users may have low expectations of certain kinds of software.
• Marketing environment
• Getting a product to market early may be more important than finding
defects in the program.
Static and dynamic verification
• 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
• Software testing: Concerned with exercising and
observing product behaviour (dynamic verification)
• The system is executed with test data and its operational behaviour is observed
V & V planning
• Careful planning is required to get the most out of testing and inspection processes.
• Planning should start early in the development process.
• The plan should identify the balance between static verification and testing.
• Test planning is about defining standards for the testing process rather than describing
product tests.
The V-model of development
Verification Validation
2. It does not involve executing the code. 2. It always involves executing the code.
4. Verification uses methods like inspections, 4. Validation uses methods like black box (functional)
reviews, walkthroughs, and Desk-checking etc. testing, gray box testing, and white box (structural)
testing etc.
5. Verification is to check whether the software 5. Validation is to check whether software meets the
conforms to specifications. customer expectations and requirements.
6. It can catch errors that validation cannot 6. It can catch errors that verification cannot catch. It is
catch. It is low level exercise. High Level Exercise.
8. Verification is done by QA team to ensure 8. Validation is carried out with the involvement of
that the software is as per the specifications in testing team.
the SRS document.
Critical systems
Mission-critical Business-critical
Safety-critical systems
systems systems
e.g. customer
e.g. chemical e.g. navigational
accounting system in a
manufacturing plant system for a spacecraft
bank
System Dependability
• For critical systems, it is usually the case that the most important system property is the
dependability of the system.
• Dependability is a non-functional requirement
Critical System
• The most emergent properties of a critical system
• Systems that are unreliable, unsafe or insecure are often rejected by their users
• Untrustworthy systems may cause information loss
Identify Compute
Prepare test Apply tests to
operational observed
data set system
profiles reliability
Reliability validation activities
• Establish the operational profile for the system.
• Construct test data reflecting the operational profile.
• Test the system and observe the number of failures and the times of these failures.
• Compute the reliability after a statistically significant number of failures have been
observed.
Reliability validation activities
• Establish the operational profile for the system.
• Construct test data reflecting the operational profile.
• Test the system and observe the number of failures and the times of these failures.
• Compute the reliability after a statistically significant number of failures have been
observed.
Statistical Testing
• Used to test for reliability, not fault detection
• Measuring the number of errors allows the reliability of the software to be predicted
• Error seeding is one approach to measuring reliability
• An acceptable level of reliability should be specified before testing begins and the
software should be modified until that level is attained
Estimating Number of Program Errors by Error Seeding
• One member of the test team places a known number of errors in the program while
other members try to find them.
• Assumption: (s/S) = (n/N)
• s = # seeded errors found during testing
• S = # of seeded errors placed in program
• n = # non-seeded (actual) errors found during testing
• N = total # of non-seeded (actual) errors in program
• This can be written as N = (S*n)/s
Error Seeding Example
• Using the error seeding assumptions
• if 75 of 100 seeded errors are found
• we believe that we have found 75% of the actual errors
• If we found 25 non-seeded errors that means actual # errors in the program is
N = (100 * 25)/75 = 33.3
Safety vs. Reliability
• Not the same thing
• Reliability is concerned with conformance to a given specification and delivery of service
• Safety is concerned with ensuring system cannot cause damage irrespective of whether
or not it conforms to its specification
A system may be reliable but not safe – but, usually, if a critical system
is unreliable it is likely to be unsafe …
Safety assurance
• Safety assurance and reliability measurement are quite different:
• Within the limits of measurement error, you know whether or not a
required level of reliability has been achieved;
• However, quantitative measurement of safety is impossible. Safety
assurance is concerned with establishing a confidence level in the
system.
Safety confidence
• Confidence in the safety of a system can vary from very low to very high.
• Confidence is developed through:
• Past experience with the company developing the software;
• The use of dependable processes and process activities geared to safety;
• Extensive V & V including both static and dynamic validation techniques.
Safety arguments
• Safety arguments are intended to show that the system cannot reach in
unsafe state.
• They are generally based on proof by contradiction
• Assume that an unsafe state can be reached;
• Show that this is contradicted by the program code.
Security checklist
Content of Lecture
• Concepts, Issues
• Testing Purpose
Basic Concept
Testing Activities