Software testing steps Test units Integrate units then test functions Integrate functions then test sub-systems Integrate sub-systems then test the complete system Software system Software sub-system 1 Software sub-system 2 Major software function 1 Major software function 2 Major software function 3 Code unit 1 Code unit 3 Code unit 2 Code unit 5 Code unit 4 Integration of parts
Introduction to static analysis Part 2 Static Analysis
Evaluating program structure - cyclomatic complexity measures McCabe’s cyclomatic complexity metric: a measure of the amount of decision logic in a code unit Cyclomatic complexity value: the number of independent paths through a control flow graph Control flow graph Graph complexity measured using Cyclomatic complexity techniques Output from module Source code decision logic Input to module Structure described using a
Control flow graph - simple sequence structure
Cyclomatic complexity value v(G): the number of independent paths through a control flow graph.
Integration and testing Part 4 Integration and test strategies
Combined unit and integration testing Unit A Unit A2 Unit A1 Test code for unit A Test 2 Integrate units A1 and A2 to form A Test code for unit A1 Unit A1 Test 1(a) Test code for unit A2 Unit A2 Test 1(b) Phase 1: test individual units. Phase 2: test the combined unit. This test must exercise all features of A1 and A2.
Reduced integration testing v v Call node (a) Original graph - v(G) = 6 Full flow graph of the integrated unit A. Reduction steps: 1. Identify ALL control structures of units A1 and A2 not concerned with external units (A). 2. Remove these from the flow graph. Reduced flow graph of the integrated unit Call node (a) Reducedl graph - v(G) = 2
Class and object testing Part 5 OO systems - Class and object testing
Use of OO metrics Evaluation of completeness and self-containment Assessment of design complexity Prediction of required test effort Use of OO metrics (class and object) Estimation of coding errors Ÿ LOC Ÿ AD Ÿ MD Ÿ MHF Ÿ AHF Ÿ LCOM Ÿ DIT Ÿ NOC Ÿ LCOM Ÿ WMC Ÿ WMC Ÿ RFC Ÿ MHF Ÿ CBO