Skip to content

Black Box, White Box, and Grey Box Testing

Black box testing

You test the system by inputs/outputs without knowing internal code.

Examples:

  • UI testing
  • API testing
  • acceptance tests

White box testing

You test with knowledge of internal implementation.

Examples:

  • unit tests
  • branch/condition coverage
  • code-level edge cases

Grey box testing

You have partial knowledge of internals.

Examples:

  • API tests with DB knowledge
  • testing with logs/metrics

Diagram

false


  graph LR
A[Black box\n(No internals)] --> B[Grey box\n(Some internals)] --> C[White box\n(Full internals)]

false

When to use what

  • Black box: verify user-visible behavior
  • White box: verify correctness and edge cases
  • Grey box: efficient end-to-end checks

If this helped you, consider buying me a coffee ☕

Buy me a coffee

Was this page helpful?

Let us know how we did