Docsity

Verification and Validation - Lecture Slides | CMSC 435, Study notes of Software Engineering

Partial preview of the text

Download Verification and Validation - Lecture Slides | CMSC 435 and more Study notes Software Engineering in PDF only on Docsity!

cmsc435 - 1

Verification and Validation

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

l To describe the Cleanroom software development process

cmsc435 - 3

The testing process

l Component (or unit) testing

 Testing of individual program components;  Usually the responsibility of the component developer (except sometimes for critical systems);  Tests are derived from the developer’s experience.

l System testing

 Testing of groups of components integrated to create a system or sub-system;  The responsibility of an independent testing team;  Tests are based on a system specification.

Other forms of testing:

Performance testing

l Part of release testing may involve testing the

emergent properties of a system, such as

performance and reliability.

l Performance tests usually involve planning a

series of tests where the load is steadily

increased until the system performance

becomes unacceptable.

cmsc435 - 7

Interface errors

l Interface misuse

 A calling component calls another component and makes an error in its use of its interface e.g. parameters in the wrong order.

l Interface misunderstanding

 A calling component embeds assumptions about the behaviour of the called component which are incorrect.

l Timing errors

 The called and the calling component operate at different speeds and out-of-date information is accessed.

Testing process goals

l Validation testing

 To demonstrate to the developer and the system customer that the software meets its requirements;  A successful test shows that the system operates as intended.

l Defect testing

 To discover faults or defects in the software where its behavior is incorrect or not in conformance with its specification;  A successful test is a test that makes the system perform incorrectly and so exposes a defect in the system.  Tests show the presence not the absence of defects

cmsc435 - 9

l Verification:

"Are we building the product right”.

 The software should conform to its specification.  Usually a priori process

l Validation:

"Are we building the right product”.

 The software should do what the user really requires.  Usually testing after being built

Verification vs validation

V& V goals

l Verification and validation should establish

confidence that the software is fit for

purpose.

 Generally this does not mean to be

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.

  • Unfortunately, users accept this

cmsc435 - 13

l Can reveal the presence of errors NOT their

absence - Dijkstra.

l The only validation technique for non-

functional requirements as the software has

to be executed to see how it behaves.

l Should be used in conjunction with static

verification to provide full V&V coverage.

Program testing

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.

 Debugging involves formulating a

hypothesis

about program behavior then testing these

hypotheses to find the system error.

Testing and debugging

cmsc435 - 15

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.

V & V planning

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.

cmsc435 - 19

Inspection pre-conditions

l A precise specification must be available. l Team members must be familiar with the organization standards. l Syntactically correct code or other system representations 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 should not use inspections for staff appraisal e.g., finding out who makes mistakes.

Reading technologies

All of the following techniques are an improvement over simply testing a program; however, some are more effective than others. Several related concepts: Walkthroughs: The developer of the artifact describes its structure at a meeting. Attendees look for flaws in the structure. Weakness – reviewers do not understand deep structure so error finding is weak. Code reviews: An individual who is not the developer of the artifact reads the text of the artifact looking for errors and defects in structure. Quite effective since reader does not have the same preconceived notion of what the artifact does. Review: A meeting to discuss an artifact – less formal than an inspection. A traditional checkpoint in software development

cmsc435 - 21

(Fagan) Inspections

Developed by Michael Fagan at IBM in 1972.

Two approaches toward inspections:

l Part of development process – used to identify

problems

l Part of quality assurance process – used to

find unresolved issues in a finished product

“Fagan inspections” are the former type. Goal is

to find defects – A defect is an instance in

which a requirement is not satisfied.

Fagan Inspections

l Development process consists of series of

stages (e.g., system design, design, coding, unit

testing, …)

l Develop exit criteria for any artifact passing

from one stage to the next

l Validate that every artifact correctly passes

the exit criteria before starting on the next

phase via an inspection meeting

l Everyone at the meeting must observe that all

the exit criteria have been met

cmsc435 - 25

Inspection participants

Author – one who developed artifact – does not

lead or defend artifact, but controls repair

Reader – one who tries to develop a design of the

artifact (Several at meeting.)

Tester – one who tries to test the artifact

Moderator – Conducts inspection; Comes from a

neutral organization

Scribe – records actions at meeting

If anyone doesn’t prepare adequately, the

meeting is often cancelled.

Inspections versus Reviews

CONCEPT REVIEW INSPECTION

Defects Opinions of attendees

Violation of specification Author Defends position Observer of proceedings Error fixing Discussions at meeting

Later process

Results List of errors to author

Formal defect list for QA and author

Measurement None required Data collected that can be used to develop baseline

cmsc435 - 27

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.

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.

cmsc435 - 31

Inspection checklists

l Checklist of common errors should be used to drive the inspection.

l Error checklists are programming language dependent and reflect the characteristic errors that are likely to arise in the language.

l In general, the 'weaker' the type checking, the larger the checklist.

l Examples: Initialization, Constant naming, loop termination, array bounds, etc.

Inspection checks 1

Data faults Are all pro gram var iables initialised before their va lues are used? Hav e all constan ts been named? Should the upper bound of arrays be equal to the size of the array or S ize -1? If cha racter strings are used, is a de limiter explicitly assi gned? Is there a ny possi bility of b uffer overflow? Control faults For each co nditional state ment, is the condition correct? Is eac h loop cer tain t o terminate? Are co mp ound s tatements correctly brack eted? In case state ments, are a ll possi ble ca ses acc ounted f or? If a break is req uired after ea ch case in case state ments, has it b een included? Input/output fau lts Are all input variables u sed? Are all output variab les assi gned a value before they are output? Can unexpecte d i nputs cause c orruption?

cmsc435 - 33

Inspection checks 2

Interface faults Do all function and method calls have the correct number of parameters? Do formal and actual parameter ty pes match? Are the parameters i n the right order? If comp onen ts access shared memo ry, do they have the same mo del of the shared m emo ry s tructure?

Storage manage me nt faults

If a linked structure is modified, have all links bee n correc tly r ea ssigned? If dynami c storage is used , has space been alloc ated correc tly? Is space explicitly de-alloca ted after it is no longer req uired?

Excep tion manage me nt faults

Have all poss ible error conditions been taken into acco unt?

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 Limited to a 2 hour block, maximum

l Inspecting 500 lines costs about 40 hours of

effort.

cmsc435 - 37

PBR: User role -

Develop tests as if you are in the role of the individual who will use the given artifact.

l Use scenarios – scripts of sequences of actions the interact with the given artifact being tested.

l Is there any information that prevents you from writing this scenario?

l Are all the necessary functions necessary to write this scenario specified in the requirements, e.g., all the capabilities listed in the general description?

l Are the effects of this scenario specified under all possible circumstances?

PBR: User role-

l Are the initial conditions for starting up this scenario clear and correct?

l Might some portion of the scenario give different answers depending on how a functional requirement is interpreted?

l Are the interfaces well defined and compatible?

l Do the requirements make sense from what I know about the application or what is specified by the general description?

l Can you get into an improper state, e.g., security or safety problems?

cmsc435 - 39

PBR: Designer role

Develop tests as if you are in the role of the individual who will design the given artifact: l Are all the necessary objects (e.g., data, types, functions) well defined? l Are all the interfaces defined and consistent? l Are all the data types compatible? l Is all the necessary information available to do the design? Are all the conditions involving all objects specified? l Are there any points that are not clear about what you should do, either because the requirement is not clear or not consistent? l Is there anything in the requirements that you cannot implement in the design? l Do the requirements make sense from what I know about the application or what is specified by the general description?

Early Studies of PBR

A Study of PBR [“The empirical investigation of perspective based reading” by Basili et al. In Empirical Software Engineering vol. 1 (1996) 133-164] shows that:

l 3 readers find more errors than an unstructured reading of a document.

l Two classes of documents read – a “typical” document and a “precise” document. Results more significant in the “formal” document. In the “typical” document, perspectives found fewer unique errors – Why?

Problem with a study like this – Would like to review 2 documents A and B switching technologies. But not possible to do PBR on A and not do PBR on B second. So PBR always second document to read and learning effects cannot be discounted.