Effective Testing Techniques

Last time we talked about the impact leaving testing to chance can have on your implementations (and it’s not good), this week we’re going to look at the different types of testing that you can use to give your testing the best chance of catching the defects it’s supposed to.

A number of effective testing techniques are usable in the unit testing stage. These can be broadly divided into three types.

  • Functional Testing
  • Structural Testing
  • Heuristic Testing

Defects in applications can be broadly classified as Omissions, Surprises and Wrong Implementations. Omissions are requirements that are missed in the code, Surprises are code that is not found in the requirements and Wrong Implementations are incorrectly coded requirements.

Defect Types

Not all techniques will pick up all types of defects.

Testing Type vs Types of Errors

Technique Omissions Surprises Wrong Implementation
Functional x x
Structural x x
Heuristic x x x

Functional testing based on the specifications alone will not reveal any rogue code and Structural Testing won’t reveal missed requirements. Heuristic or intuitive testing will catch all types of defects, but intuitive testing is only really effective when combined with the systematic techniques of Functional and Structural testing.

Functional Testing Techniques (some Examples)

Boundary Value Analysis
Testing the edge conditions of boundaries
Equivalence Partitioning
Grouping test cases into classes in which one test case is equivalent to executing any other tests in the same class.
Cause Effect Graphing
When the behaviour of the unit under test is specified as cause and effect. Test cases are then designed that validate this relationship.

Structural Testing Techniques (some examples)

Statement Coverage
Identify test cases, such that every line of code is executed in one case or another.
Branch Coverage
Identify test cases, such that every branch of code is executed in one test or another. 100% Branch coverage automatically assures 100% statement coverage.
Condition Coverage
Identify test cases such that every condition in each predicate expression is evaluated all possible ways.
Modified Condition-Decision Coverage
Identify test cases such that each boolean operand can independently affect the outcome of a decision.

Next we’ll start looking into Functional Testing techniques in more detail.See you soon!