CS615 – Software Engineering I

Lecture 8

Chapter 18: Software Testing Strategies

Strategic Approach to Software Testing

Criteria for Completion of Testing


 

f(t) = (1/p) ln [ lopt + 1]

where

f(t)  =  cumulative number of failures that are expected to occur once the software has been tested for a certain amount of execution time, t,

lo  =  the initial software failure intensity (failures per time unit) at the beginning of testing,

p  =  the exponential reduction in failure intensity as errors are uncovered and repairs are made.

 

l(t) = 1o/( lopt + 1)

Strategic Testing Issues

Unit Testing
Focuses verification effort on the smallest unit of software design—the software component or module

(1) misunderstood or incorrect arithmetic precedence
(2) mixed mode operations
(3) incorrect initialization
(4) precision inaccuracy
(5) incorrect symbolic representation of an expression

(1) comparison of different data types
(2) incorrect logical operators or precedence
(3) expectation of equality when precision error makes equality unlikely
(4) incorrect comparison of variables
(5) improper or nonexistent loop termination
(6) failure to exit when divergent iteration is encountered
(7) improperly modified loop variables

Integration Testing

1.     Main control module used as a test driver and stubs are substitutes for components directly subordinate to it.

2.     Subordinate stubs are replaced one at a time with real components (following the depth-first or breadth-first approach).

3.     Tests are conducted as each component is integrated.

4.     On completion of each set of tests and other stub is replaced with a real component.

5.     Regression testing may be used to ensure that new errors not introduced.


0.     Low level components are combined in clusters that perform a specific software function.

1.     A driver (control program) is written to coordinate test case input and output.

2.     The cluster is tested.

3.     Drivers are removed and clusters are combined moving upward in the program structure.

0.     Representative sample of existing test cases is used to exercise all software functions.

1.     Additional test cases focusing software functions likely to be affected by the change.

2.     Tests cases that focus on the changed software components.

With each passing day, more of the software has been integrated and more has been demonstrated to work

1.     Software components already translated into code are integrated into a build.

2.     A series of tests designed to expose errors that will keep the build from performing its functions are created.

3.     The build is integrated with the other builds and the entire product is smoke tested daily (either top-down or bottom integration may be used).

Integration Test Documentation

Validation Testing

Acceptance Testing

System Testing

Debugging

Bug Removal Considerations

 

Chapter 19: Technical Metrics for Software

Overview

Software Quality Principles

McCall's Quality Factors


 

McCall's Software Metrics - (Subjective)

Relationship between quality factors and metrics

FURPS Quality Factors (Hewlett-Packard)

ISO 9126 Quality Factors

Measurement Process Activities

Formulation Principles for Technical Metrics

Software Metric Attributes

Representative Analysis Metrics

e.g. Part of the analysis model for SafeHome software

 


FP = count total x [0.65 + 0.01 x S (Fi)]

where count total is the sum of all FP entries and Fi (i = 1 to 14) are "complexity adjustment values." For the purposes of this example, we assume that S (Fi) is 46 (a moderately complex product).

FP = 50 x [0.65 + (0.01 x 46)] = 56

RE/FuP < 0.7 implies a function-strong application
0.8 < RE/FuP < 1.4 implies a hybrid application
RE/FuP > 1.5 implies a data-strong application

Representative Design Metrics

S(i) = f 2out (i)

D(i) = v(i) / [ fout (i) ]

where v(i) is the number of input and output variables that are passed to and from module i

C(i) = S(i) + D(i)

size = n + a

where n is the number of nodes and a is the number of arcs

size = 17 + 18 = 35

depth =  the longest path from the root (top) node to a leaf node

For above - depth = 4.

width  =  maximum number of nodes at any one level of the architecture

For above - width = 6.


arc-to-node ratio, r = a/n, measures connectivity density of the architecture

For above - r = 18/17 = 1.06


s1 =  the total number of modules defined in the program architecture.
s2 =  the number of modules whose correct function depends on the source of data input or that produce data to be used elsewhere (in general, control modules, among others, would not be counted as part of ).
s3 =  the number of modules whose correct function depends on prior processing.
s4 =  the number of database items (includes data objects and all attributes that define objects).
s5 =  the total number of unique database items.
s6 =  the number of database segments (different records or individual objects).
s7 =  the number of modules with a single entry and exit (exception processing is not considered to be a multiple exit).


 

 

Program structure: D1, where D1 is defined as follows:


Module independence: D2 = 1 - (s2/s1)
Modules not dependent on prior processing: D3 = 1 - (s3/s1)
Database size: D4 = 1 - (s5/s4)
Database compartmentalization: D5 = 1 - (s6/s4)
Module entrance/exit characteristic: D6 = 1 - (s7/s1)
 

 DSQI = SUM(wiDi)

where i = 1 to 6, wi is the relative weighting of the importance of each of the intermediate values, and S wi = 1 (if all Di are weighted equally, then wi = 0.167).


 


di = number of input data parameters
ci = number of input control parameters
do = number of output data parameters
co = number of output control parameters


gd = number of global variables used as data
gc = number of global variables used as control


w = number of modules called (fan-out)
r = number of modules calling the module under consideration (fan-in)

mc = k/M

where k = 1, a proportionality constant and

M = di + (a x ci) + do + (b x co) + gd + (c x gc) + w + r

where a = b = c = 2

mc = 1/(1 + 0 + 1+ 0 + 0 + + 0 + 1 + 0) = 1/3 = 0.33

mc = 1/[5 + (2 x 5) + 5 + (2 x 5) + 10 + 0 + 3 + 4] = 0.02

C = 1 - mc

where the degree of coupling increases nonlinearly between a minimum value in the range 0.66 to a maximum value that approaches 1.0.

cost = Sum[frequency of transition(k) x cost of transition(k)]

LA = 100 x [ (cost of LA - optimal layout)/(cost of proposed layout)]

where LA = 100 for an optimal layout.

number of possible layouts = [N!/(K! x (N - K)!] x K!

 Source Code Metrics - Halstead's Software Science


n2 = the number of distinct operands that appear in a program.
N1 = the total number of operator occurrences.
N2 = the total number of operand occurrences

N = n1 log2 n1 + n2 log2 n2

V log2 ( n1 + n2 )

L = 2/n1 x n2 /N2

Testing Metrics

Maintenance Metrics


MT =   the number of modules in the current release
Fc =  the number of modules in the current release that have been changed
Fa =  the number of modules in the current release that have been added
Fd =  the number of modules from the preceding release that were deleted in the current release

SMI = [MT - (Fa + Fc + Fd)] / M