Thursday, August 13, 2009

Black Box Testing Vs White Box Testing

Black Box Testing

Black Box Testing refers to the technique of testing a system with no knowledge of the internals of the system. Black Box testers do not have access to the source code and are oblivious of the system architecture.

A Black Box tester typically interacts with a system through a user interface by providing inputs and examining outputs without knowing how and where the inputs where operated upon.

In Black Box testing, target software is exercised over a range of inputs and the outputs are observed for correctness.

Advantages

  1. Efficient Testing- Well-suited and efficient for large code segments or units
  2. Unbiased Testing- clearly separates user's perspective from developer's perspective.
  3. Non-intrusive- Code access not required
  4. Easy to execute- can be carried out by moderately skilled testers with no knowledge of implementation, programming language, operating systems or networks.
Disadvantages

  1. Localized Testing- Limited code path coverage since only a limited number of test inputs are actually tested.
  2. Inefficient Test Authoring- Without implementation information, exhaustive input coverage would take forever and would require tremendous resources.
  3. Blind Coverage- Cannot control targeting code segments which may be more error prone than others.
White Box Testing

White Box testing refers to the technique of testing a system with knowledge of the internals of the system. White Box testers have access to the source code and are aware of the system architecture.

A White Box tester typically analyzes source code, derives test cases from knowledge of the source code and finally targets specific code paths to achieve a certain level of code coverage.

A White Box tester with access to details about both operations can readily craft efficient test cases that exercise boundary conditions.

Advantages

  1. Increased Effectiveness- Cross-checking design and assumptions against source code outlives effective implementation.
  2. Full code pathway capable- All the possible code pathways can be tested including error handling, resource dependencies and additional internal code logic/flow.
  3. Early Defect Identification- Analyzing source code and developing test based on the implementation details enables testers to find programming errors quickly.
  4. Reveal hidden code flaws- Access to source code improves understanding and uncovering unintended hidden behaviour of program modules.
Disadvantages

  1. Difficult to scale- requires skilled and expert testers, with intimate knowledge of target system, testing tools and coding languages.
  2. Difficult to maintain- requires specialized tools such as source code analyzers, debuggers and fault injectors.
  3. Highly Intrusive- Requires code modification to be done using interactive debuggers or by actually changing the source code. This may be adequate for small programs, but it does not scale well to larger applications.