Software Engineering 10IS5110CS51 unit 7

The Eduladder is a community of students, teachers, and programmers just interested to make you pass any exams. So we solve previous year question papers for you.
In eduladder you can Ask,Answer,Listen,Earn and Download Questions and Question papers.
Watch related videos of your favorite subject.
Connect with students from different parts of the world.
Apply or Post Jobs, Courses ,Internships and Volunteering opportunity. For FREE
See Our team
Wondering how we keep quality?
Got unsolved questions? Ask Questions


You are here:Open notes-->VTU-->Software-Engineering-10IS5110CS51-unit-7

Software Engineering [10IS51/10CS51] unit-7

UNIT 7
VERIFICATION AND VALIDATION

Verification vs. validation
Verification: "Are we building the product right”, The software should
conform to its specification.
Validation: "Are we building the right product”., The software should do what
the user really requires.
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
 Page 71
 
Static and dynamic V&V
I
Program testing
Can reveal the presence of errors NOT their absence. The only validation
technique for non-functional requirements as the software has to be executed
to see how it behaves. Should be used in conjunction with static verification to
provide full V&V coverage.
Types of testing
? Defect testing: Tests designed to discover system defects. A
successful defect test is one which reveals the presence of defects in
a system. Covered in Chapter 23
? Validation testing: Intended to show that the software meets its
requirements. A successful test is one that shows that a requirement
has been properly implemented.
Testing and debugging
?Defect testing and debugging are distinct processes. Verification
and validation is concerned with establishing the existence of
defects in a program. Debugging is concerned with locating and
repairing these errors. Debugging involves formulating a hypothesis
about program behaviour then testing these hypotheses to find the
system error.
The debugging process
I
 Page 72
 
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
I
The structure of a software test plan
? The testing process.
? Requirements traceability.
? Tested items.
? Testing schedule.
? Test recording procedures.
? Hardware and software requirements.
? Constraints.
 Page 73
 
The software test plan
The testing process
A description of the major phases of the testing process. These might be
as described earlier in this chapter.
Requirements traceability
Users are most interested in the system meeting its requirements and
testing should be planned so that all requirements are individually tested.
Tested items
The products of the software process that are to be tested should be
specified.
Testing schedule
An overall testing schedule and resource allocation for this schedule.
This, obviously, is linked to the more general project development
schedule.
Test recording procedures
It is not enough simply to run tests. The results of the tests must be
systematically recorded. It must be possible to audit the testing process
to check that it been carried out correctly.
Hardware and software requirements
This section should set out software tools required and estimated
hardware utilisation.
Constraints
Constraints affecting the testing process such as staff shortages should
be anticipated in this section.
Software inspections
These involve people examining the source representation with the aim of
discovering anomalies and defects.
Inspections not require execution of a system so may be used before
implementation.
They may be applied to any representation of the system (requirements,
design, configuration data, test data, etc.).
They have been shown to be an effective technique for discovering program
errors.
Inspection success
Many different defects may be discovered in a single inspection. In
testing, one defect, may mask another so several executions are
required. The reuse domain and programming knowledge so
reviewers are likely to have seen the types of error that commonly
arise.
Inspections and testing
Inspections and testing are complementary and not opposing
verification techniques. Both should be used during the V & V
process. Inspections can check conformance with a specification but
not conformance with the customer’s real requirements. Inspections
 Page 74
 
cannot check non-functional characteristics such as performance,
usability, etc.
Program inspections
Formalised approach to document reviews. Intended explicitly for
defect detection (not correction). 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.
Inspection pre-conditions
? A precise specification must be available.
? Team members must be familiar with the organisation standards.
? Syntactically correct code or other system representations must be
available.
? An error checklist should be prepared.
? Management must accept that inspection will increase costs early
in the software process.
? Management should not use inspections for staff appraisal i.e.
finding out who makes mistakes.
The inspection process
I
Inspection procedure
? System overview presented to inspection team.
? Code and associated documents are distributed to inspection
team in advance.
? Inspection takes place and discovered errors are noted.
? Modifications are made to repair discovered errors.
? Re-inspection may or may not be required.
 Page 75
 
Inspection roles
Author or owner The programmer or designer responsible for
producing the program or document. Responsible
for fixing defects discovered during the inspection
process.
Inspector Finds errors, omissions and inconsistencies in
programs and documents. May also identify
broader issues that are outside the scope of the
inspection team.
Reader Presents the code or document at an inspection
meeting.
Scribe Records the results of the inspection meeting.
Chairman or moderator Manages the process and facilitates the inspection.
Reports process results to the Chief moderator.
Chief moderator Responsible for inspection process improvements,
checklist updating, standards development etc.
Inspection checklists
? Checklist of common errors should be used to drive the inspection.
? Error checklists are programming language dependent and reflect the
characteristic errors that are likely to arise in the language.
? In general, the 'weaker' the type checking, the larger the checklist.
? Examples: Initialisation, Constant naming, loop termination, array
bounds, etc.
Inspection check
Data faults are all program variables initialized before
their values are used?
Have all constants been named?
Should the lower bound of arrays be 0, 1,
or
something else?
Should the upper bound of arrays be equal
to the size of the array or Size -1?
If character strings are used, is a delimiter
explicitly assigned?
Control faults for each conditional statement, is the
condition
correct?
Is each loop certain to terminate?
 Page 76
 
Are compound statements correctly
bracketed?
In case statements, are all possible cases
accounted for?
Input/output faults are all input variables
used?
Are all output variables assigned 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?
Segment faults If a linked structure is modified, have all
links been correctly reassigned?
If dynamic storage is used, has space been
allocated correctly?
Is space explicitly de-allocated after it is
no longer Inspection checks required?
Exception Management Have all possible error conditions been
taken
into account?
Inspection rate
500 statements/hour during overview. 125 source statement/hour during
individual
preparation. 90-125 statements/hour can be inspected. Inspection is therefore
an expensive process. Inspecting 500 lines costs about 40 man/hours effort -
about £2800 at UK rates.
Automated static analysis
? Static analysers are software tools for source text processing.
? They parse the program text and try to discover potentially erroneous
conditions and bring these to the attention of the V & V team.
? They are very effective as an aid to inspections - they are a supplement
to but not a replacement for inspections.
Stages of static analysis
? Control flow analysis. Checks for loops with multiple exit or entry
points, finds unreachable code, etc.
 Page 77
 
? Data use analysis. Detects uninitialised variables, variables written
twice without an intervening assignment, variables which are declared
but never used, etc.
? Interface analysis. Checks the consistency of routine and procedure
declarations and their use.
? Information flow analysis. Identifies the dependencies of output
variables. Does not detect anomalies itself but highlights information
for code inspection or review
? Path analysis. Identifies paths through the program and sets out the
statements executed in that path. Again, potentially useful in the
review process
? Both these stages generate vast amounts of information. They must be
used with care.
LINT static analysis
138% more lint_ex.c
#include
printarray (Anarray)
int Anarray;
{
printf(“%d”,Anarray);
}
main ()
{
int Anarray[5]; int i; char c;
printarray (Anarray, i, c);
printarray (Anarray) ;
}
139% cc lint_ex.c
140% lint lint_ex.c
lint_ex.c(10): warning: c may be used before set
lint_ex.c(10): warning: i may be used before set
printarray: variable # of args. lint_ex.c(4) :: lint_ex.c(10)
printarray, arg. 1 used inconsistently lint_ex.c(4) ::
lint_ex.c(10)
printarray, arg. 1 used inconsistently lint_ex.c(4) ::
LINT static analysis
lint_ex.c(11)
printf returns value which is always ignored.
Use of static analysis
Particularly valuable when a language such as C is used which has weak
typing and hence many errors are undetected by the compiler, Less costeffective
for languages like Java that have strong type checking and can
therefore detect many errors during compilation.
 Page 78
 
Verification and formal methods
? Formal methods can be used when a mathematical specification
of the system is produced.
? They are the ultimate static verification technique.
? They involve detailed mathematical analysis of the
specification and may develop formal arguments that a program
conforms to its mathematical specification.
Arguments for formal methods
Producing a mathematical specification requires a detailed analysis
of the requirements and this is likely to uncover errors. They can
detect implementation errors before testing when the program is
analyzed alongside the specification.
Arguments against formal methods
? Require specialized notations that cannot be understood by
domain experts.
? Very expensive to develop a specification and even more
expensive to show that a program meets that specification.
? It may be possible to reach the same level of confidence in a
program more cheaply using other V & V techniques.
Cleanroom software development
The name is derived from the ‘Cleanroom’ process in
semiconductor fabrication. The
philosophy is defect avoidance rather than defect removal.
This software development process is based on:
? Incremental development;
? Formal specification;
? Static verification using correctness arguments;
? Statistical testing to determine program reliability.
The Cleanroom process
I
Cleanroom process characteristics
? Formal specification using a state transition model.
 Page 79
 
? Incremental development where the customer prioritises
increments.
? Structured programming - limited control and abstraction
constructs are used in the program.
? Static verification using rigorous inspections.
? Statistical testing of the system
Formal specification and inspections
? The state based model is a system specification and the
inspection process checks the program against this mode. l
? The programming approach is defined so that the
correspondence between the model and the system is clear.
? Mathematical arguments (not proofs) are used to increase
confidence in the inspection process.
Cleanroom process teams
Specification team: Responsible for developing and maintaining the
system specification.
Development team: Responsible for developing and verifying the
software. The software is NOT executed or even compiled during
this process.
Certification team: Responsible for developing a set of statistical
tests to exercise the software after development. Reliability growth
models used to determine when reliability is acceptable.
Cleanroom process evaluation
? The results of using the Cleanroom process have been very
impressive with few discovered faults in delivered systems.
? Independent assessment shows that the process is no more
expensive than other approaches.
? There were fewer errors than in a 'traditional' development
process.
? However, the process is not widely used. It is not clear how this
approach can be transferred to an environment with less skilled or
less motivated software engineers.
The testing process
Component 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.
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.
 Page 80
 
ITesting phases
\
Defect testing
? The goal of defect testing is to discover defects in programs
? A successful defect test is a test which causes a program to
behave in an anomalous way
? Tests show the presence not the absence of defects
Testing process goals
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.
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.
The software testing process
I
Testing policies
Only exhaustive testing can show a program is free from defects.
However, exhaustive testing is impossible,
Testing policies define the approach to be used in selecting system
tests:
?All functions accessed through menus should be tested;
?Combinations of functions accessed through the same menu should
be tested;
 Page 81
 
?Where user input is required, all functions must be tested with
correct and incorrect input.
System testing
? Involves integrating components to create a system or subsystem.
? May involve testing an increment to be delivered to the
customer.
? Two phases:
Integration testing - the test team have access to the system source
code. The system is tested as components are integrated.
Release testing - the test team test the complete system to be
delivered as a black-box.
Integration testing
? Involves building a system from its components and testing it
for problems that arise from component interactions.
Top-down integration: Develop the skeleton of the system and
populate it with components.
Bottom-up integration: Integrate infrastructure components then add
functional components.
? To simplify error localisation, systems should be incrementally
integrated.
Incremental integration testing
I
Testing approaches
? Architectural validation: Top-down integration testing is better
at discovering errors in the system architecture.
? System demonstration: Top-down 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 both approaches. Extra code
may be required to observe tests.
 Page 82
 
Release testing
? The process of testing a release of a system that will be
distributed to customers.
? Primary goal is to increase the supplier’s confidence that the
system meets its requirements.
? Release testing is usually black-box or functional testing
? Based on the system specification only;
? Testers do not have knowledge of the system implementation.
Black-box testing
I
Testing guidelines
Testing guidelines are hints for the testing team to help them choose
tests that will reveal defects in the system
? Choose inputs that force the system to generate all error
messages;
? Design inputs that cause buffers to overflow;
? Repeat the same input or input series several times;
? Force invalid outputs to be generated;
? Force computation results to be too large or too small.
System tests
1 . T e s t th e l o g in m e c h a n i s m u s i n g c o r r e c t a n d i n c o r re c t l o g in s to c h e c k
t h a t v a l i d u s e rs a r e a c c e p te d a n d i n v a l i d u s e rs a re r e je c t e d .
2 . T e s t t h e s e a r c h f a c i li t y u s i n g d if f e r e n t q u e r ie s a g a in s t k n o w n s o u r c e s to
c h e c k t h a t th e s e a r c h m e c h a n i s m is a c t u a l ly f i n d i n g d o c u m e n t s .
3 . T e s t th e s y s te m p re s e n t a t i o n f a c i l i t y t o c h e c k th a t i n f o rm a t i o n a b o u t
d o c u m e n t s is d i s p la y e d p r o p e r ly .
4 . T e s t t h e m e c h a n is m t o r e q u e s t p e r m is s i o n f o r d o w n l o a d i n g .
5 . T e s t th e e -m a i l r e s p o n s e in d i c a t i n g th a t th e d o w n l o a d e d d o c u m e n t i s
a v a i l a b l e .
 Page 83
 
Use cases
Use cases can be a basis for deriving the tests for a system. They
help identify operations to be tested and help design the required
test cases. From an associated sequence diagram, the inputs and
outputs to be created for the tests can be identified.
Collect weather data sequence chart
I
Performance testing
Part of release testing may involve testing the emergent properties
of a system, such as performance and reliability. Performance tests
usually involve planning a series of tests where the load is steadily
increased until the system performance becomes unacceptable.
Stress testing
? Exercises the system beyond its maximum design load.
Stressing the system often causes defects to
come to light.
? Stressing the system test failure behaviour.. Systems should not
fail catastrophically. Stress testing checks for unacceptable loss of
service or data.
? Stress testing is particularly relevant to distributed systems that
can exhibit severe degradation as a
network becomes overloaded.
Component testing
? Component or unit testing is the process of testing individual
components in isolation.
 Page 84
 
? It is a defect testing process.
? Components may be:
? Individual functions or methods within an object;
? Object classes with several attributes and methods;
? Composite components with defined interfaces used to access
their functionality.
Object class testing
Complete test coverage of a class involves
? Testing all operations associated with an object;
? Setting and interrogating all object attributes;
? Exercising the object in all possible states.
Inheritance makes it more difficult to design object class tests as the
information to be tested is not localised.
Weather station object interface
I
Weather station testing
?Need to define test cases for reportWeather, calibrate, test, startup
and shutdown.
?Using a state model, identify sequences of state transitions to be
tested and the event sequences to cause these transitions
For example:
?Waiting -> Calibrating -> Testing -> Transmitting -> Waiting.
Interface testing
? Objectives are to detect faults due to interface errors or invalid
assumptions about interfaces.
 Page 85
 
? Particularly important for object-oriented development as
objects are defined by their interfaces.
Interface testing
I
Interface types
? Parameter interfaces: Data passed from one procedure to
another.
? Shared memory interfaces: Block of memory is shared between
procedures or functions.
? Procedural interfaces: Sub-system encapsulates a set of
procedures to be called by other sub-systems.
? Message passing interfaces: Sub-systems request services from
other sub-systems
Interface errors
? 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.
? Interface misunderstanding: A calling component embeds
assumptions about the behaviour of the called component which are
incorrect.
 Page 86
 
? Timing errors: The called and the calling component operate at
different speeds and out-of-date information is accessed.
Interface testing guidelines
? Design tests so that parameters to a called procedure are at the
extreme ends of their ranges.
? Always test pointer parameters with null pointers.
? Design tests which cause the component to fail.
? Use stress testing in message passing systems.
? In shared memory systems, vary the order in which components
are activated.
Test case design
? Involves designing the test cases (inputs and outputs) used to
test the system.
? The goal of test case design is to create a set of tests that are
effective in validation and defect testing.
? Design approaches:
? Requirements-based testing;
? Partition testing;
? Structural testing.
Requirements based testing
A general principle of requirements engineering is that requirements
should be testable. Requirements-based testing is a validation
testing technique where you consider each requirement and derive a
set of tests for that requirement.
LIBSYS requirementsLIBSYS tests
The user shall be able to search either all of the initial set of databases or select a
subset from it.
The system shall provide appropriate viewers for the user to read documents in the
document store.
Every order shall be allocated a unique identifier (ORDER_ID) that the user shall
be able to copy to the accountO
 Page 87
s permanent storage area.
 
Partition testing
? Input data and output results often fall into different classes
where all members of a class are related.
? Each of these classes is an equivalence partition or domain
where the program behaves in an equivalent way for each class
member.
? Initiate user search for searches for items that are known to
be present and known not to be present, where the set of
databases includes 1 database.
? Initiate user searches for items that are known to be present
and known not to be present, where the set of databases
includes 2 databases
? Initiate user searches for items that are known to be present
and known not to be present where the set of databases
includes more than 2 databases.
? Select one database from the set of databases and initiate
user searches for items that are known to be present and
known not to be present.
? Select more than one database from the set of databases
and initiate searches for items that are known to be present
and known not to be present.
? Test cases should be chosen from each partition.
Equivalence partitioning
I
 Page 88
 
Equivalence partitions
I
Search routine specification
procedure Search (Key : ELEM ; T: SEQ of ELEM;
Found : in out BOOLEAN; L: in out ELEM_INDEX) ;
Pre-condition
-- the sequence has at least one element
T’FIRST <= T’LAST
Post-condition
-- the element is found and is referenced by L
( Found and T (L) = Key)
or
-- the element is not in the array
( not Found and
not (exists i, T’FIRST >= i <= T’LAST, T (i) = Key ))
Search routine - input partitions
? Inputs which conform to the pre-conditions.
? Inputs where a pre-condition does not hold.
? Inputs where the key element is a member of the array.
? Inputs where the key element is not a member of the array.
Testing guidelines (sequences)
? Test software with sequences which have only a single value.
? Use sequences of different sizes in different tests.
? Derive tests so that the first, middle and last elements of the
sequence are accessed.
? Test with sequences of zero length.
 Page 89
 
Search routine - input partitions
Seq uence Elem e nt
Single value In sequence
Single value N ot in sequence
M ore than 1 value First elem ent in sequenc e
M ore than 1 value Last elem ent in sequence
M ore than 1 value M iddle elem ent in sequence
M ore than 1 value N ot in sequence
Input sequence (T) K ey (K ey) O u tput (Found, L)
17 17 true, 1
17 0 false, ??
17, 29, 21, 23 17 true, 1
41, 18, 9, 31, 30, 16, 45 45 true, 7
17, 18, 21, 23, 29, 41, 38 23 true, 4
21, 23, 29, 33, 38 25 false, ??
Structural testing
Sometime called white-box testing. Derivation of test cases
according to program structure. Knowledge of the program is used
to identify additional test cases. Objective is to exercise all program
statements (not all path combinations)
I
Binary search - equiv. partitions
? Pre-conditions satisfied, key element in array.
? Pre-conditions satisfied, key element not in
array.
? Pre-conditions unsatisfied, key element in array.
? Pre-conditions unsatisfied, key element not in array.
? Input array has a single value.
? Input array has an even number of values.
 Page 90
 
? Input array has an odd number of values
I
Binary search - test cases
Input array (T) Key (Key) Output (Found, L)
17 17 true, 1
17 0 false, ??
17, 21, 23, 29 17 true, 1
9, 16, 18, 30, 31, 41, 45 45 true, 7
17, 18, 21, 23, 29, 38, 41 23 true, 4
17, 18, 21, 23, 29, 33, 38 21 true, 3
12, 18, 21, 23, 32 23 true, 4
21, 23, 29, 33, 38 25 false, ??
Path testing
? The objective of path testing is to ensure that the set of test
cases is such that each path through the program is executed at least
once.
? The starting point for path testing is a program flow graph that
shows nodes representing program decisions and arcs representing
the flow of control.
? Statements with conditions are therefore nodes in the flow
graph.
 Page 91
 
Binary search flow graph
I
Independent paths
?1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 14
?1, 2, 3, 4, 5, 14
?1, 2, 3, 4, 5, 6, 7, 11, 12, 5, …
?1, 2, 3, 4, 6, 7, 2, 11, 13, 5, …
?Test cases should be derived so that all of these paths are executed
?A dynamic program analyser may be used to check that paths have
been executed
Test automation
? Testing is an expensive process phase. Testing workbenches
provide a range of tools to reduce the time required and total testing
costs.
? Systems such as Junit support the automatic execution of tests.
? Most testing workbenches are open systems because testing
needs are organisation-specific.
? They are sometimes difficult to integrate with closed design
and analysis workbenches.
 Page 92
 
A testing workbench
I
Testing workbench adaptation
? Scripts may be developed for user interface simulators and
patterns for test data generators.
? Test outputs may have to be prepared manually for comparison.
? Special-purpose file comparators may be developed.

Editors




You might like this video:Software engineering
Watch more here

Watch more videos from this user Here

Learn how to upload a video and start earning here