Explain Black Box Testing and White Box Testing in detail

Black Box Testing:

In black-box testing, test cases are designed from an examination of the input/output values only and no knowledge of design or code is required. There are two main approaches available to design black-box test cases:
1. Equivalence class partitioning
2. Boundary value analysis

Equivalence Class Partitioning:

In the equivalence class partitioning approach, the domain of input values to the program under test is partitioned into a set of equivalence classes. The partitioning is done such that for every input data belonging to the same equivalence class, the program behaves similarly.

Boundary Value Analysis:

A type of programming error that is frequently committed by programmers is missing out on the special consideration that should be given to the values at the boundaries of different equivalence classes of inputs. The reason behind programmers committing such errors might purely be due to psychological factors. Programmers often fail to properly address the special processing required by the input values that lie at the boundary of the different equivalence classes.

White-Box Testing:

White-box testing is an important type of unit testing. A large number of white-box testing strategies exist. Each testing strategy essentially designs test cases based on analysis of some aspect of source code and is based on some heuristic.

Basic Concepts of White-Box Testing:

A white-box testing strategy can either be coverage-based or fault-based.

1. Fault-based testing: A fault-based testing strategy targets to detect certain types of faults. These faults that a test strategy focuses on constitute the fault model of the strategy.

2. Coverage-based testing: A coverage-based testing strategy attempts to execute certain elements of a program.