software test and analysis in a nutshell · 2017. 1. 17. · (c) 2007 mauro pezzè & michal...

23
(c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 1 Software Test and Analysis in a Nutshell

Upload: others

Post on 01-Jan-2021

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Software Test and Analysis in a Nutshell · 2017. 1. 17. · (c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 1 Software Test and Analysis in a Nutshell

(c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 1

Software Test and Analysis in a Nutshell

Page 2: Software Test and Analysis in a Nutshell · 2017. 1. 17. · (c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 1 Software Test and Analysis in a Nutshell

(c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 2

Learning objectives

• View the “big picture'' of software quality in

the context of a software development project

and organization:

• Introduce the range of software verification

and validation activities

• Provide a rationale for selecting and combining

them within a software development process.

Page 3: Software Test and Analysis in a Nutshell · 2017. 1. 17. · (c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 1 Software Test and Analysis in a Nutshell

(c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 3

Engineering processes

• Sophisticated tools

– amplify capabilities

– but do not remove human error

• Engineering disciplines pair

– construction activities with

– activities that check intermediate and final products

• Software engineering is no exception:

construction of high quality software requires

– construction and

– verification activities

Page 4: Software Test and Analysis in a Nutshell · 2017. 1. 17. · (c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 1 Software Test and Analysis in a Nutshell

(c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 4

Verification and design activities

• Verification and design activities take various

forms

– suited to highly repetitive construction of non-

critical items for mass markets

– highly customized or highly critical products.

• Appropriate verification activities depend on

– engineering discipline

– construction process

– final product

– quality requirements.

Page 5: Software Test and Analysis in a Nutshell · 2017. 1. 17. · (c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 1 Software Test and Analysis in a Nutshell

(c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 5

Peculiarities of software

Software has some characteristics that make V&V particularly difficult: – Many different quality requirements

– Evolving (and deteriorating) structure

– Inherent non-linearity

– Uneven distribution of faults

Example

If an elevator can safely carry a load of 1000 kg, it can also safely carry any smaller load; If a procedure correctly sorts a set of 256 elements, it may fail on a set of 255 or 53 or 12 elements, as well as on 257 or 1023.

Page 6: Software Test and Analysis in a Nutshell · 2017. 1. 17. · (c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 1 Software Test and Analysis in a Nutshell

(c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 6

Impact of new technologies

• Advanced development technologies

– can reduce the frequency of some classes of errors

– but do not eliminate errors

• New development approaches can introduce

new kinds of faults

examples

– deadlock or race conditions for distributed software

– new problems due to the use of polymorphism,

dynamic binding and private state in object-oriented

software.

Page 7: Software Test and Analysis in a Nutshell · 2017. 1. 17. · (c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 1 Software Test and Analysis in a Nutshell

(c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 7

Variety of approaches

• There are no fixed recipes

• Test designers must

– choose and schedule the right blend of techniques

• to reach the required level of quality

• within cost constraints

– design a specific solution that suits

• the problem

• the requirements

• the development environment

Page 8: Software Test and Analysis in a Nutshell · 2017. 1. 17. · (c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 1 Software Test and Analysis in a Nutshell

(c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 8

Five Basic Questions

1. When do verification and validation start?

When are they complete?

2. What particular techniques should be applied

during development?

3. How can we assess the readiness of a product?

4. How can we control the quality of successive

releases?

5. How can the development process itself be

improved?

Page 9: Software Test and Analysis in a Nutshell · 2017. 1. 17. · (c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 1 Software Test and Analysis in a Nutshell

(c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 9

1: When do V&V start? When are they complete?

• Test is not a (late) phase of software

development

– Execution of tests is a small part of the verification

and validation process

• V&V start as soon as we decide to build a

software product, or even before

• V&V last far beyond the product delivery

as long as the software is in use, to cope with

evolution and adaptations to new conditions

Page 10: Software Test and Analysis in a Nutshell · 2017. 1. 17. · (c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 1 Software Test and Analysis in a Nutshell

(c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 13

Requirements

Elicitation

Requirements

Specification

Architectural

Design

Detailed

DesignUnit Coding

Integration &

DeliveryMaintenance

Plan

ning

& m

onito

ring

Verif

icatio

n of

spec

ste

st ca

se e

xecu

tion

and

sw va

lidat

ion

Identify qualites

Plan acceptance test

Validate specifications

Plan system test

Plan unit & integration test

Gene

ratio

n of

tests

Inspect architectural design

Analyze architectural design

Inspect detailed design

Monitor the A&T process

Generate system test

Generate integration test

Generate unit test

Generate regression test

Update regression test

Code inspection

Design scaffolding

Design oracles

Execute unit test

Execute integration test

Analyze coverage

Generate structural test

Execute system test

Execute acceptance test

Execute regression test

Collect data on faults

analyze faults and improve the processProc

ess

impr

ovem

ent

Staging A&T techniques

Page 11: Software Test and Analysis in a Nutshell · 2017. 1. 17. · (c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 1 Software Test and Analysis in a Nutshell

(c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 14

3: How can we assess the readiness of a product?

• A&T during development aim at revealing faults

• We cannot reveal are remove all faults

• A&T cannot last indefinitely: we want to know

if products meet the quality requirements

• We must specify the required level of

dependability

• and determine when that level has been

attained.

Page 12: Software Test and Analysis in a Nutshell · 2017. 1. 17. · (c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 1 Software Test and Analysis in a Nutshell

(c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 15

Different measures of dependability

• Availability measures the quality of service in

terms of running versus down time

• Mean time between failures (MTBF) measures

the quality of the service in terms of time

between failures

• Reliability indicates the fraction of all

attempted operations that complete

successfully

Page 13: Software Test and Analysis in a Nutshell · 2017. 1. 17. · (c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 1 Software Test and Analysis in a Nutshell

(c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 16

Example of different dependability measures

Web application:

• 50 interactions terminating with a credit card charge.

• The software always operates flawlessly up to the point that a credit card is to be charged, but on half the attempts it charges the wrong amount.

What is the reliability of the system?

• If we count the fraction of individual interactions that are correctly carried out, only one operation in 100 fail: The system is 99% reliable.

• If we count entire sessions, only 50% reliable, since half the sessions result in an improper credit card charge

Page 14: Software Test and Analysis in a Nutshell · 2017. 1. 17. · (c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 1 Software Test and Analysis in a Nutshell

(c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 22

Summary

• The quality process has three different goals:

– Improving a software product

– assessing the quality of the software product

– improving the quality process

• We need to combine several A&T techniques through

the software process

• A&T depend on organization and application domain.

• Cost-effectiveness depends on the extent to which

techniques can be re-applied as the product evolves.

• Planning and monitoring are essential to evaluate and

refine the quality process.

Page 15: Software Test and Analysis in a Nutshell · 2017. 1. 17. · (c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 1 Software Test and Analysis in a Nutshell

A Framework for Testing andA Framework for Testing and Analysis

(c) 2007 Mauro Pezzè & Michal Young Ch 2, slide 1

Page 16: Software Test and Analysis in a Nutshell · 2017. 1. 17. · (c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 1 Software Test and Analysis in a Nutshell

Learning objectivesLearning objectives

• Introduce dimensions and tradeoff between • Introduce dimensions and tradeoff between test and analysis activitiesDi ti i h lid ti f ifi ti • Distinguish validation from verification activities

• Understand limitations and possibilities of test and analysis

(c) 2007 Mauro Pezzè & Michal Young Ch 2, slide 2

Page 17: Software Test and Analysis in a Nutshell · 2017. 1. 17. · (c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 1 Software Test and Analysis in a Nutshell

Verification and validationVerification and validation

• Validation: • Validation: does the software system meets the user's real needs?needs?

are we building the right software?

• Verification: does the software system meets the requirements specifications?q p

are we building the software right?

(c) 2007 Mauro Pezzè & Michal Young Ch 2, slide 3

Page 18: Software Test and Analysis in a Nutshell · 2017. 1. 17. · (c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 1 Software Test and Analysis in a Nutshell

Validation and VerificationValidation and Verification

ActualSW

SpecsS tRequirements System

Validation V ifi tiValidation VerificationIncludes usability testing user

Includes testing, inspections statictesting, user

feedbackinspections, static analysis

(c) 2007 Mauro Pezzè & Michal Young Ch 2, slide 4

Page 19: Software Test and Analysis in a Nutshell · 2017. 1. 17. · (c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 1 Software Test and Analysis in a Nutshell

Verification or validation depends on the specification

1 2 3 4 5 6 7 8

Example: elevator response

Unverifiable (but validatable) spec: ... if a user presses a request button at floor i, an available l i fl i elevator must arrive at floor i soon...

Verifiable spec: ... if a user presses a request p p qbutton at floor i, an available elevator must arrive at floor i within 30 seconds...

(c) 2007 Mauro Pezzè & Michal Young Ch 2, slide 5

Page 20: Software Test and Analysis in a Nutshell · 2017. 1. 17. · (c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 1 Software Test and Analysis in a Nutshell

Validation and Verification ActivitiesValidation and Verification Activities

Rev

iew

validation

verification

(c) 2007 Mauro Pezzè & Michal Young Ch 2, slide 6

Page 21: Software Test and Analysis in a Nutshell · 2017. 1. 17. · (c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 1 Software Test and Analysis in a Nutshell

Y ’t l t h t tever

You can’t always get what you want

Property

DecisionProcedureProgram

Pass/FailProgram

Correctness properties are undecidableCorrectness properties are undecidablethe halting problem can be embedded in almost g p

every property of interest

(c) 2007 Mauro Pezzè & Michal Young Ch 2, slide 7

Page 22: Software Test and Analysis in a Nutshell · 2017. 1. 17. · (c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 1 Software Test and Analysis in a Nutshell

Getting what you needGetting what you need ...Perfect verification ofarbitrary properties by

Theorem proving:Unbounded effort to

if l • optimistic inaccuracy: we may y p p ylogical proof or exhaustivetesting (Infinite effort)

Model checking:Decidable but possiblyi t t bl h ki f

verify generalproperties.

p y yaccept some programs that do not possess the property (i.e., it may not detect all

intractable checking ofsimple temporal

properties.Data flowanalysis

yviolations). – testing

• pessimistic inaccuracy: it is

Precise analysis ofsimple syntacticproperties.

Typical testingtechniques

pessimistic inaccuracy: it is not guaranteed to accept a program even if the program does possess the property p p p p p ybeing analyzed– automated program analysis

techniquesOptimisticinaccuracy

Pessimisticinaccuracy

Simplifiedproperties

• simplified properties: reduce the degree of freedom for simplifying the property to

(c) 2007 Mauro Pezzè & Michal Young Ch 2, slide 8

p y g p p ycheck

Page 23: Software Test and Analysis in a Nutshell · 2017. 1. 17. · (c) 2007 Mauro Pezzè & Michal Young Ch 1, slide 1 Software Test and Analysis in a Nutshell

SummarySummary

• Most interesting properties are undecidable • Most interesting properties are undecidable, thus in general we cannot count on tools that work without human intevention

• Assessing program qualities comprises two complementary sets of activities: validation p y(daes the software do what it is supposed to do?) and verification (does the system behave as specificed?)

• There is no single technique for all purposes: test designers need to select a suitable combination of techniques

(c) 2007 Mauro Pezzè & Michal Young Ch 2, slide 11