Software testing approaches that examine the program structure and derive test data from the program logic. Structural testing is sometimes referred to as clear-box testing since white boxes are considered opaque and do not really permit visibility into the code.

Synonyms for white box testing

  • Glass Box testing
  • Structural testing
  • Clear Box testing
  • Open Box Testing

Types of White Box testing

The purpose of white box testing

Initiate a strategic initiative to build quality throughout the life cycle of a software product or service.

Provide a complementary function to black box testing.

Perform complete coverage at the component level.

Improve quality by optimizing performance.

Practices :

This section outlines some of the general practices comprising white-box testing process. In general, white-box testing practices have the

following considerations:

  1. The allocation of resources to perform class and method analysis and to document and review the same.
  2. Developing a test harness made up of stubs, drivers and test object libraries.
  3. Development and use of standard procedures, naming conventions and libraries.
  4. Establishment and maintenance of regression test suites and procedures.
  5. Allocation of resources to design, document and manage a test history library.
  6. The means to develop or acquire tool support for automation of capture/replay/compare, test suite execution, results verification and documentation capabilities.

Code Coverage Analysis

Path Testing

A testing mechanism proposed by McCabe whose aim is to derive a logical complexity measure of a procedural design and use this as a guide for defining a basic set of execution paths. These are test cases that exercise basic set will execute every statement at least once.

Flow Graph Notation

A notation for representing control flow similar to flow charts and UML activity diagrams.


The cyclomatic complexity gives a quantitative measure of 4the logical complexity. This value gives the number of independent paths in the basis set, and an upper bound for the number of tests to ensure that each statement is executed at least once. An independent path is any path through a program that introduces at least one new set of processing statements or a new condition (i.e., a new edge). Cyclomatic complexity provides upper bound for number of tests required to guarantee coverage of all program statements.

Control Structure testing

Conditions Testing

Condition testing aims to exercise all logical conditions in a program module. They may define:

· Relational expression: (E1 op E2), where E1 and E2 are arithmetic expressions.

· Simple condition: Boolean variable or relational expression, possibly proceeded by a NOT operator.

· Compound condition: composed of two or more simple conditions, Boolean operators and parentheses.

· Boolean expression : Condition without Relational expressions.

Data Flow Testing

Selects test paths according to the location of definitions and use of variables.

Loop Testing

Loops fundamental to many algorithms. Can define loops as simple, concatenated, nested, and unstructured.


Note that unstructured loops are not to be tested . rather, they are redesigned.

Design by Contract (DbC)

DbC is a formal way of using comments to incorporate specification information into the code itself. Basically, the code specification is expressed unambiguously using a formal language that describes the code's implicit contracts. These contracts specify such requirements as:

· Conditions that the client must meet before a method is invoked.

· Conditions that a method must meet after it executes.

· Assertions that a method must satisfy at specific points of its execution

Tools that check DbC contracts at runtime such as JContract [http://www.parasoft.com/products/jtract/index.htm] are used to perform this function.


Profiling provides a framework for analyzing Java code performance for speed and heap memory use. It identifies routines that are consuming the majority of the CPU time so that problems may be tracked down to improve performance.

These include the use of Microsoft Java Profiler API and Sun’s profiling tools that are bundled with the JDK. Third party tools such as JaViz [http://www.research.ibm.com/journal/sj/391/kazi.html] may also be used to perform this function.

Error Handling

Exception and error handling is checked thoroughly are simulating partial and complete fail-over by operating on error causing test vectors. Proper error recovery, notification and logging are checked against references to validate program design.


Systems that employ transaction, local or distributed, may be validated to ensure that ACID (Atomicity, Consistency, Isolation, Durability). Each of the individual parameters is tested individually against a reference data set.

Transactions are checked thoroughly for partial/complete commits and rollbacks encompassing databases and other XA compliant transaction processors.

Advantages of White Box Testing

  • Forces test developer to reason carefully about implementation
  • Approximate the partitioning done by execution equivalence
  • Reveals errors in "hidden" code
  • Beneficent side-effects

Disadvantages of White Box Testing

  • Expensive
  • Cases omitted in the code could be missed out.

No comments:


My Blog List