The universe of testing automation can be neatly split into two predominant testing techniques known as black-box and white-box testing.

Other test design techniques exist, including gray-box testing, which is a combination of the previous two, however black-box and white-box testing approaches are the most widespread.

In this article, we explore the advantages and disadvantages of black-box and white-box testing, determine who’s most likely to benefit from these two techniques, as well as when is the most appropriate time to use them.

Click Here To Download Your Practical Test Case Template Now (it’s free)

Black-box, white-box, what’s the difference?

Black-box testing White-box testing
Definition: Software testing method where the internal structure of the system is not known Software testing method where the internal structure of the system is known
Used for: Verifying input methods and outputs of the system. Verifying internal structure     of system’s components
Performed by: Testers Developers
Applicable to: Systems and Acceptance testing Unit testing
Perspective User Developer
Introspection No Yes
Coding knowledge: No Yes
Implementation knowledge: No Yes
Test cases: Based on requirements Based on detailed design

 

Black-box testing: Just kicking the tyres

Black-box testing focuses solely on the functionality of the software interfaces, ensuring that valid inputs are accepted, invalid inputs rejected, and that at all times a correct output is returned.

black-box-testing-closed

In black-box testing, the inner workings of the system are always ‘closed’ to the tester.

The internals of the system are never known to the tester, the latter is only concerned with the expected outcome of the software and not with the underlying process that makes it happen.

Click Here To Download Your Practical Test Case Template Now (it’s free)

A popular analogy is when a person want to figure out if a car is working by turning on and off the lights, honking the horn once or twice, and check if the engine starts smoothly when they turn the key.

Black-box testing is the most common kind of testing technique used in organisations where testers do not work with developers, and particularly if the testers are not proficient in coding either.

The advantages of black-box testing include:

  1. Easier to carry out since code access and extensive programmatic knowledge are not required
  2. Simplifies testing process by focussing only on inputs and outputs.
  3. Allows for quicker test case development as testers have to examine only the GUI paths that a typical user would take

The disadvantages of black-box testing include:

  1. Script maintenance difficult to carry out if the user interface is constantly changing, altering input methods
  2. High degree of fragility since screens may not be rendered consistently on different platforms or devices, causing testing scripts to fail in their execution
  3. No introspection, since testers have limited knowledge of the system and how it works
  4. Restricted coverage since only a small portion of possible test scenarios can be performed

White-box testing: Taking a look under the hood

In contrast with black-box testing, where you can only be aware of what goes in and comes out of the system, white-box lets you study its inner workings and integrates this knowledge into the testing process, giving the opportunity to carry out more sophisticated procedures.

white-box-testing-open

In white-box testing, testers have access to the programmatic structure of the system.

White-box testing is the equivalent of taking your car to a mechanic and having him open the bonnet to take a look at the engine and all the other mechanical and electrical parts inside to make sure the vehicle is in good shape.

In fact, a tester using white-box testing techniques will interact directly with the internal components of a system and make use of his or her knowledge of the software code and programming skills to test the objects that make up an application.

The advantages of white-box testing include:

  1. Spotting errors and problems more quickly
  2. Providing introspection, or the ability to look into the software and examine it more thoroughly
  3. Finding hidden bugs more efficiently and ensuring greater stability
  4. Optimising the code due to the programming knowledge required
  5. Obtaining maximum coverage of the different paths present

The disadvantages of white-box testing include:

  1. Higher degree of complexity involved due to the detailed programming knowledge needed
  2. More script maintenance needed as the underlying code can change frequently, making it more likely that testing scripts could break
  3. Requires tools that have tighter integration with the system being testing, which poses the risk of system performance then being affected by those same tools, thus interfering with the results

This testing technique is especially predominant in unit testing, whereby a tester examines at a detailed level that the code written for a particular component works in isolation before integrating it with the rest of the system. It is used less often in higher-level testing.

Test Driven Development (TDD) is a developmental model that features frequently in white-box testing.

So, which testing technique is the most important?

Basically, both testing approaches are equally important when considering their contribution to the level at which they are implemented:

  • White-box testing is important to catch defects at unit level early on during the development stage, preventing small problems from snowballing into catastrophic errors after the code has been integrated into the main system.
  • Black-box testing, on the other hand, ensures that all the different software modules work well at a system level after having been integrated together.

Their relative importance changes, however, when viewed from the perspectives of the professionals who are likely to use them. White-box testing is more likely to be employed by developers, whereas black-box testing tends to be a speciality of testers or quality assurance.

In any case, both testing techniques are necessary for successful software delivery and with a platform like ReQtest you can harness more effectively the power of both.

ReQtest can be used to easily outline black-box test cases and track their implementation on a system. The checklist functionality in ReQtest lets you carry out white-box testing just as easily, since you can structure your tests in a more organised way and avoid the tendency to rely on ad hoc techniques, which reduce the effectiveness of white-box testing.

Click Here To Download Your Practical Test Case Template Now (it’s free)

Author Ulf Eriksson

Ulf is the founder of ReQtest and as the Product Owner, decides what features are added to the product, and makes sure that ReQtest is of a consistently high quality. Ulf has written several books and courses as well as a library of articles on the subjects of testing and requirements management, as well as speaking publicly on a number of subjects related to the world of testing.

More posts by Ulf Eriksson

Leave a Reply