Approach/Implementation White Box Black Box
Structural Control-flow
Data-flow
Fault-based Mutation
Error-based Functional Random

Control-flow Techniques

Example

IF (A OR B) THEN
    print C

Statement Coverage

Require each statement in the program been executed.

e.g.

  1. T1: A=TRUE, B=FALSE

Branch Coverage

Require each breanch of each control structure been executed.

e.g.

  1. T1: A=TRUE, B=FALSE
  2. T2: A=FALSE, B=FALSE

Conditiona Coverage

Require each boolean sub-expression evaluated both to true and false.

e.g.

  1. T1: A=TRUE, B=FALSE
  2. T2: A=FALSE, B=TRUE

Decision/Condition Coverage

Requires that both decision and condition coverage been satisfied.

e.g.

  1. T1: A=TRUE, B=FALSE
  2. T2: A=FALSE, B=TRUE
  3. T3: A=FALSE, B=FALSE

Multiple Condition Coverage

Require all the combinations of boolean sub-expressions should be evaluated

  1. A=TRUE, B=FALSE
  2. A=FALSE, B=TRUE
  3. A=FALSE, B=FALSE
  4. A=TRUE,B=TRUE

Basic Path Testing

Analyze the sequences of statements from the program input to output - paths of a program and drwa the control flow graph.

Flowchart

Flowchart

Cyclomatic Complexity

Determine Basic Set of Independent Paths - Equivalent to Decision/Consition Coverage

Example

  1. 1 - 2 - 4 - 5 - 8 - 10
  2. 1 - 2 - 3 - 2 - 4 - 5 - 8 - 10
  3. 1 - 2 - 4 - 6 - 8 - 10
  4. 1 - 2 - 4 - 6 - 7 - 8 - 10
  5. 1 - 2 - 4 - 5 - 8 - 9 - 10
  6. 1 - 2 - 4 - 5 - 8 - 9 - 2 - 4 - 5 - 8 - 10

Modern Practice

Functional Techniques

Equivalence Partitioning

Equivalence Partitioning

Value Range

Number of Values

Logical/Boolean Situation

Set of input values
Other

Equivalence Partitioning’s Example

Banking application, where the user can perform some bank transactions. The information for accessing the transactions requires the following input:

Bank Code

Blank or three-digit number. The first digit of the three-digit number should be greater than 1.

Branch Code

A four-digit number, the first of which is greater than 0.

Account Number

Five-digit number.

Password

Five-position alphanumerical value.

Order

Either blank or one of the following two strings: “Checkbook” or “Transactions”

Generate Test Cases

Boundary Value Analysis

Boundary Value Analysis

Value Range

Design test cases for the two bounds of the range, and another two cases for situations just above and just below these bounds

Number of Values

Design two test cases for the minimum and maximum values, as well as another two test cases for values just above the maximum and just below the minimum

Order Set

Pay attention to the first and last elements of the set.

Output

Apply the above rules to output data as well

Blackbox Testing Technique

Decision Table Technique

Input 1 (Tow Possible Values) Possible Value 1 Possible Value 2 Possible Value 1 Possible Value 2 Possible Value 1 Possible Value 2
Input 2 (Three Possible Values) Possible Value 1 Possible Value 1 Possible Value 2 Possible Value 2 Possible Value 3 Possible Value 3
Expected Result Expected Result 1 Expected Result 2 Expected Result 3 Expected Result 4 Expected Result 5 Expected Result 6

State Transition Technique

Transition Model

PIN Example

PIN Transition Diagram
PIN Transition Table

Web Login Example

State Login Validation Next State
S1 First Attempt Invalid S2
S2 Second Attempt Invalid S3
S3 Third Attempt Valid S4
S4 Redirect to Home page
S5 Redirect to Error Page
State Login Validation Next State
S1 First Attempt Invalid S2
S2 Second Attempt Invalid S3
S3 Third Attempt Invalid S5
S4 Redirect to Home page
S5 Redirect to Error Page

Test Case Specification

Test goal

High level description of the purpose of the test case.

Inputs

Actual inputs given to the program.

Expected outputs

Description of the program output according to the specification.

Observed outputs

Description of the program output when it is run

Failure Identification

Failures are identified by comparing expected outputs against observed outputs.