Home | | Software Engineering | Control Structure Testing

Chapter: Software Engineering : Testing and Implementation

Control Structure Testing

Control structure testing is a group of white-box testing methods. Branch Testing, · Condition Testing, Data Flow Testing, Loop Testing.

Control Structure Testing

 

Control structure testing is a group of white-box testing methods.

 

·         Branch Testing

 

·         Condition Testing

 

·         Data Flow Testing

 

·         Loop Testing

 

1. Branch Testing

 

·        also called Decision Testing

 

·        definition: "For every decision, each branch needs to be executed at least once."

 

·        shortcoming - ignores implicit paths that result from compound conditionals.

 

·        Treats a compound conditional as a single statement. (We count each branch taken out of the decision, regardless which condition lead to the branch.)

 

 

·        This example has two branches to be executed:

 

IF ( a equals b) THEN statement 1

 

ELSE statement 2

 

END IF

 

·        This examples also has just two branches to be executed, despite the compound conditional:

 

IF ( a equals b AND c less than d ) THEN statement 1

 

ELSE statement 2

 

END IF

 

·        This example has four branches to be executed:

 

IF ( a equals b) THEN statement 1

 

ELSE

 

IF ( c equals d) THEN statement 2

 

ELSE statement 3

 

END IF

END IF

 

·        Obvious decision statements are if, for, while, switch.

 

·        Subtle decisions are return boolean expression, ternary expressions, try-catch.

 

·        For this course you don't need to write test cases for IOException and OutOfMemory exception.

 

·        See this problem and solution.

 

 

 

2.Condition Testing

 

Condition testing is a test construction method that focuses on exercising the logical conditions in a program module.

 

Errors in conditions can be due to:

 

·        Boolean operator error

 

·        Boolean variable error

 

·        Boolean parenthesis error

 

·        Relational operator error

 

·        Arithmetic expression error

 

definition: "For a compound condition C, the true and false branches of C and every simple condition in C need to be executed at least once."

 

 

Multiple-condition testing requires that all true-false combinations of simple conditions be exercised at least once. Therefore, all statements, branches, and conditions are necessarily covered.

 

3. Data Flow Testing

Selects test paths according to the location of definitions and use of variables. This is a somewhat sophisticated technique and is not practical for extensive use. Its use should be targeted to modules with nested if and loop statements.

 

4. Loop Testing

 

Loops are fundamental to many algorithms and need thorough testing.

 

There are four different classes of loops: simple, concatenated, nested, and unstructured.

 

Examples:


Create a set of tests that force the following situations:

 

·        Simple Loops, where n is the maximum number of allowable passes through the loop. o Skip loop entirely

 

o Only one pass through loop o Two passes through loop

m passes through loop where m<n.

(n-1), n, and (n+1) passes through the loop.

 

·        Nested Loops

o   Start with inner loop. Set all other loops to minimum values.

o   Conduct simple loop testing on inner loop.

o   Work outwards

o   Continue until all loops tested.

 

·        Concatenated Loops

 

o   If independent loops, use simple loop testing.

o   If dependent, treat as nested loops.

 

·        Unstructured loops

 

 

o   Don't test - redesign.


Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
Software Engineering : Testing and Implementation : Control Structure Testing |


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.