3.1.3 Differences between Static and Dynamic Testing

Static testing and dynamic testing can have the same objectives (see section 1.1.1), such as providing an assessment of the quality of the work products and identifying defects as early as possible. Static and dynamic testing complement each other by finding different types of defects.

One main distinction is that static testing finds defects in work products directly rather than identifying failures caused by defects when the software is run. A defect can reside in a work product for a very long time without causing a failure. The path where the defect lies may be rarely exercised or hard to reach, so it will not be easy to construct and execute a dynamic test that encounters it. Static testing may be able to find the defect with much less effort.

Another distinction is that static testing can be used to improve the consistency and internal quality of work products, while dynamic testing typically focuses on externally visible behaviors.

Compared with dynamic testing, typical defects that are easier and cheaper to find and fix through static testing include:

  • Requirement defects (e.g., inconsistencies, ambiguities, contradictions, omissions, inaccuracies, and redundancies)

  • Design defects (e.g., inefficient algorithms or database structures, high coupling, low cohesion)

  • Coding defects (e.g., variables with undefined values, variables that are declared but never used, unreachable code, duplicate code)

  • Deviations from standards (e.g., lack of adherence to coding standards)

  • Incorrect interface specifications (e.g., different units of measurement used by the calling system than by the called system)

  • Security vulnerabilities (e.g., susceptibility to buffer overflows)

  • Gaps or inaccuracies in test basis traceability or coverage (e.g., missing tests for an acceptance criterion)

Moreover, most types of maintainability defects can only be found by static testing (e.g., improper modularization, poor reusability of components, code that is difficult to analyze and modify without introducing new defects).

Last updated