Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Systems V & V, Quality and Standards Dr Sita Ramakrishnan School CSSE Monash University.

Similar presentations


Presentation on theme: "1 Systems V & V, Quality and Standards Dr Sita Ramakrishnan School CSSE Monash University."— Presentation transcript:

1 1 Systems V & V, Quality and Standards Dr Sita Ramakrishnan School CSSE Monash University

2 © S Ramakrishnan2 Test Coverage Criteria based on Data Flow Mechanisms zTopics y Program Structure y Categories of Data Flow Coverage Criteria y Data Flow Testing References: xPeters J F and Pedrycz W,Software Engineering, An Engineering Approach, McGraW Hill, 2000, (Ch.12, Software Testing, pp ) xHorgan J.R., London S., Lyu M.R. Achieving software quality with testing coverage measures. IEEE Computer, Sep. 1994: xOther references (books included in the slides, conference & journal papers) given in the handout for the unit

3 © S Ramakrishnan3 Program Structure y Program consists of blocks y Block consists of a sequence of statements y When a first statement is executed, the following statements are executed in the given order y Can be represented by a flow graph

4 © S Ramakrishnan4 Testing Coverage y Have looked at testing techniques such as: xBlack-box testing which includes categories such as: Syntax-driven driven testing – where specification is described by a certain grammar. -> Generate test cases such that each production rule is applied/tested at least once Decision-table based testing – may suit if requirements have been written as if-then rules Cause-effect graphs in functional testing – addresses limitations of decision table where all inputs are treated separately although real world problem demand another approach. Boundary-value analysis & equivalence class partition also assume the independence of input xStructural testing – includes basic categories such as statement, branch & path coverage tests

5 © S Ramakrishnan5 Testing Coverage yMore on Black-box Testing with Cause-Effect Graphs: x Cause-effect graphs capture relationships between specific combination of inputs (causes) and outputs (effects). Helps avoid combinatorial explosion associated with decision table approach x Causes and Effects represented as nodes of a cause-effect graph – includes intermediate nodes to link cause & effects in forming logical expressions

6 © S Ramakrishnan6 Testing Coverage – Cause-Effect Graphs yEg. of an ATM transaction system. Causes and Effected listed as: y Causes: C1 : Command is credit, C2: Command is Debit C3: Account No. is valid, C4: Trans. Amount is valid y Effects: E1: Print “invalid command”, E2: “invalid acct no” E3: “debit no. not valid”, E4 & E5: debit & credit a/c respectively C2 C1 C3 C4 E1 E2 E5 E4 E3 or and Cause-effect graph

7 © S Ramakrishnan7 Testing Coverage – Cause-Effect Graphs y 4 input (Cause) nodes & 5 output (Effect) nodes y the node in between input (C ) & output (E ) realise “and” or “or” operators y Processing node used in cause-effect graph – and, or, negation, and with processing node, x“and” - effect occurs if all inputs are true x“or” - effect occurs if at least one input is true x “negation” – effect occurs if inputs are false y Cause-Effect graph helps determine the corresponding test cases

8 © S Ramakrishnan8 Testing Coverage – Cause-Effect Graphs y Eg. To determine test cases from C-E Graph xWant to find out the causes for E3 say given: C2 C3 C4 and E3 C1 C2 C3 C4 X X= (don’t care condition) 1 = true, 0 = false E3 does not depend on Cause (C1)

9 © S Ramakrishnan9 Test coverage based on Data Flow Coverage Criteria y Why data flow orientation in testing? x Data structures and their usage are essential elements of any code and hence need to be taken into account when looking at software testing yMain categories of data flow coverage criteria x basic block x all-use x c-use x d-use x du-path

10 © S Ramakrishnan10 Test coverage based on Data Flow Coverage Criteria In a piece of Java code:Eg sum = 0;Definitions shown in blue prod = 0; i = 1; while (i <= n) { sum+ = i; basic block shown in purple prod* = i; ->prod* = i an eg of “use” i++ -> i++ also an eg of “use” }if “use” appears in a computational if (k == 0) print_results1;expression, the pair is c-use, if in predicate, resulting pair is p-use if (k == 1) compute;

11 © S Ramakrishnan11 Test coverage based on Data Flow Coverage Criteria yDefinition – value stored in a memory location xDefined (d) – data structure is defined, created or initialized when it is given a valid state yUse – value fetched from a memory location yC-use – used in computation or output statement & - associated with each node yP-use – used in a predicate& associated with each edge C-uses Decision Basic Block Hierarchy of different dataflow coverage criteria P-uses All-uses

12 © S Ramakrishnan12 Test coverage based on Data Flow Coverage Criteria yDef-use Graph xObtained from the flow graph xAssociate with each node the sets C-use (i) - variables which have global c-uses in block i Def (i) - variables with global definitions in block i xAssociate with each edge (i,j) P-use (i,j) – variables which have p-uses on edge (i,j) xDefine sets of nodes dpu(x,i) - edges (j,k) such that x Є p-use(j,k) and there is a def-clear path w.r.t. x from i to (j,k) dcu(x,i) - nodes j such that x Є c-use(j) and there is a def- clear path w.r.t. x from i to j

13 © S Ramakrishnan13 Test coverage based on Data Flow Coverage Criteria yDef-use Graph Paths – Definitions yComplete path – path from entry node to exit node yDef-clear path w.r.t. x from node i to node j and from node i to edge n m, j a path (i, n1,n2, …n, j) containing no definitions or undefinitions of x in nodes n1, n2, ….n m m

14 © S Ramakrishnan14 Test coverage based on Data Flow Coverage Criteria yData flow coverage criteria – yThe family of data flow testing criteria is based on requiring that – xThe test data execute definition-clear paths from each node containing a global definition of a variable to specified nodes containing global c-uses and edge containing p-uses of that variable yFor each variable definition, data flow testing criteria require that xAll/some definition-clear paths w.r.t. that variable from the node containing the definition to all/some of that uses/c-uses/p-uses reachable by some such paths be executed

15 © S Ramakrishnan15 Test coverage based on Data Flow Coverage Criteria yAll-def criterion xIf variable x has a global definition in node i, the all-defs criterion requires the test data to exercise some path which goes from i to some node or edge at which the value assigned to x in node i is used yAll-uses criterion xIf variable x has a global definition in node i, the all-uses criterion requires the test data to exercise at least one path which goes from i to each node or edge at which the value assigned to x in node i is used

16 © S Ramakrishnan16 Test coverage based on Data Flow Coverage Criteria yAll-DU-paths criterion xIf variable x has a global definition in node i, the all-DU- paths criterion requires the test data to exercise all paths which go from i to each node and edge at which the value assigned to x in node i is used yOther DF testing criteria xAll-p-uses xAll-c-uses xAll-p-uses/some-c-uses xAll-c-uses/some-p-uses

17 © S Ramakrishnan17 Test coverage based on Data Flow Coverage Criteria Hierarchy of data flow coverage criteria all-paths all-du-paths all-uses all-c-uses-some-p-usesall-p-uses-some-c-uses all-c-uses all-defs all-p-uses all-edges all-nodes

18 © S Ramakrishnan18 Test coverage based on Data Flow Coverage Criteria xInterprocedural Data Flow Testing Most df testing methods deal with dependencies that exist within a procedure – intra procedural aspect Data dependencies may also exist between procedures Requires analysis of flow of data across these procedure/module boundaries

19 © S Ramakrishnan19 Test coverage based on Data Flow Coverage Criteria xHomework: Closer look at Table 12.6 Coverage Criteria on P.479 in Peters & Pedrycz text (see slide 1 for Reference details)


Download ppt "1 Systems V & V, Quality and Standards Dr Sita Ramakrishnan School CSSE Monash University."

Similar presentations


Ads by Google