Testing is a process of validating and verifying that an application, software, website and product is working as expected. Both the testing forms mentioned above are equally important and depends on the domains in which they're applied. The primary purpose is to detect software failures so that the defects may be discovered and corrected. Let us discuss them in detail:

White Box Testing

It is a method of testing in which the internal structure is checked and code is verified, keeping in mind the design specification. Here are some points:
  • The application is tested at the source code level.
  • Testing for loops, if-else statements etc., are part of white-box testing.
  • Done by testers and developers.

Black Box Testing

Black Box Testing is performed without having much knowledge of the internal workings of the software. Here are some points:
  • It tests how the software behaves as a whole and analyzes client requirement specifications.
  • Usually done with those who have no knowledge of the actual code.
  • Done by end-users, testers and developers.

Comparison

·Role:

White Box Testing: Its role is to find common defects in code.
Black Box Testing: It verifies that the requirements are met and examines the functionality of an application.

·Granularity

Granularity in testing is a way to determine the expected result for a test case.
White Box Testing: High granularity.
Black Box Testing: Low granularity when compared with white box testing.

·Other names:

White Box Testing: It is also known as glass box, transparent box, structural testing and non-functional testing
Black Box Testing: It is also known as closed box, functional testing.

·Performed by:

White Box Testing: This type of testing is done by testers and developers.
Black Box Testing: This is done by end-users, testers and developers.

·Domain

White Box Testing: It is suited for all domains.
Black Box Testing: It is suited only for business domain testing.

·Algorithm Testing

White Box Testing: Algorithm testing is suitable for white box testing.
Black Box Testing: Algorithm testing is not considered suitable for black box testing.

·Basis for Test Cases

White Box Testing: The test case is based on detail design.
Black Box Testing: The test case is built around requirements and specifications.

·Programming Knowledge

White Box Testing: For performing black box testing, programming skills are necessary to test the internal structure. Sometimes, a programmer with high level knowledge is required.
Black Box Testing: For performing black box testing, programming skills are not required. It is done with those who usually have no knowledge of the actual code.

·Maintenance

White Box Testing: Maintenance is difficult as it uses debuggers, compilers and other tools.
Black Box Testing: Maintenance is easier.

·Test Case

White Box Testing: Test Cases are easier to design.
Black Box Testing: It’s difficult to design test cases in black box testing.

·Time

White Box Testing: It is time-consuming as internal structure is tested.
Black Box Testing: Takes less time when compared with White Box.

·Testing Stage

White Box Testing: It is performed early in the testing process.
Black Box Testing: It is applied during the later stages of testing.

·Errors

White Box Testing: It attempts to find errors in internal logic of program.
Black Box Testing: It attempts to find the following errors:
  • initialization errors
  • incorrect functions error
  • database access errors

·Levels

White Box Testing: Applicable to lower levels of testing:
  • Unit testing, and
  • Integration Testing.
Black Box Testing: Applicable to higher levels of testing:
  •  Acceptance Testing, and
  •  System Testing

·Implementation Knowledge

White Box Testing: Implementation Knowledge is required.
Black Box Testing: Implementation Knowledge is not necessary for black box  testing.

·Selection of Test Cases

White Box Testing: Large number of test cases are to be written for white box.
Black Box Testing: It is based on the selection of sample test cases.

·Internal Structure

White Box Testing: The internal structure is known.
Black Box Testing: Tests how the software behaves as a whole, so internal structure is not known.

·Techniques

White Box Testing techniques:
  • Control flow testing
  • Data flow testing
  • Branch testing
  • Path testing
  • Statement coverage
  • Decision coverage
 
Black Box Testing techniques:
  • Decision table testing
  • All-pairs testing
  • Equivalence partitioning
  • Boundary value analysis
  • Cause–effect graph
  • Error guessing