Difference Between White Box, Black Box, and Gray Box Testing

Difference Between White Box, Black Box, and Gray Box Testing
March 01 16:00 2011 Print This Article

Note: the article was updated in September 2018.

In this article, we are going to talk about three common approaches to software testing: white-box, black-box, and grey-box testing. We will find out the benefits of each of these approaches and their main specific features.

Black-box testing

Black-box method is a testing approach when QA specialists have no access to the source code or the internal structure of software. The main goal of this testing type is to check whether everything works well from the point of view of an ordinary user.

Black box Approach

Main features:

  • it doesn’t require the understanding of the software internal structure
  • test design is elaborated according to the software specification

Focuses on:

  • incorrect or missing functions
  • GUI errors
  • data structures errors
  • inadequate software performance
  • control flow errors

Test design techniques based on black-box testing:

  • equivalents classes
  • boundary values analysis
  • decision tables
  • state changing diagrams

Advantages of black-box testing:

  • no need for a tester to know the programming language of the application
  • tests preparation time is short
  • testers start designing test cases just after the specification is ready
  • testers can notice some specification contradictions

Disadvantages of black-box testing:

  • only some random paths are covered
  • it is impossible to anticipate what part of the code can cause a problem in future
  • it is hard to design test cases without a specification
  • lack of information for detailed testing

White-box testing

White-box testing is a testing approach when QA specialists have an access to the source code and internal structure of the software. This testing type implies that a tester knows which code line is called for each functionality. It gives an opportunity not only to better choose an entry data set but also to check errors and exceptions handling.

White box approach

The main features of white-box testing are:

  • test cases are based on the system internal structure analysis
  • proper for unit tests, integration tests, and system tests
  • the expected result is clear

Focuses on:

  • bad code writing practices
  • security holes
  • the functionality of conditional loops
  • working flow of the code
  • memory leaks

Test design techniques based on white-box testing:

  • statement coverage
  • branch coverage
  • path coverage
  • function coverage

Advantages of white-box testing:

  • testing can be conducted in the early stages of the software lifecycle
  • no need to wait for the GUI implementation
  • it is possible to conduct more detailed testing with more cases covered
  • it is possible to anticipate the potential problems

Disadvantages of black-box testing:

  • a tester must know the programming language of the software
  • takes much more time than other approaches
  • can be complex and expensive

Grey-box testing

Grey-box testing is a testing approach when the testers have only a partial access to the internal structure. Often it includes databases and the information about algorithms used, though it depends on the case.  Still, testing is done from the point of view of an ordinary user like in the case of black-box testing.

Grey box approach

Main features:

  • test design is based on the data structures and algorithms knowledge
  • actual tests are conducted using the exposed interfaces
  • a tester can have an access to the source code for test cases design

Test design techniques based on grey box testing:

  • matrix testing
  • regression testing
  • orthogonal array testing
  • pattern testing

The grey box testing incorporates advantages and disadvantages of white-box and black-box techniques and can be a good compromise in the question which of the techniques to choose.

Related Posts:

About Article Author

view more articles
Nataliia Vasylyna
Nataliia Vasylyna

View More Articles

2 Comments

write a comment
  1. misha
    April 04, 06:02 #1 misha

    Thanks,
    This all knowledge of White-box testing are really helpful.

    Reply to this comment
  2. iCanStay
    April 26, 09:54 #2 iCanStay

    iCanStay.com provide the coupons based stay in india. iCanStay coupons based stay in five star @2999/- only. Its secure and reliable coupons stay delhi or any where in India.
    iCanStay LuxuryStay

    Reply to this comment

Add a Comment

Your data will be safe! Your e-mail address will not be published. Also other data will not be shared with third person.
All fields are required.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.