Black Box Testing and White Box Testing : : Everything You Need To Know

Hello Folks,

In this post, we will see below topics:

  1. What is White box testing?
  2. What is Black box testing?
  3. What are differences between White box and Black box testing?

There are many testing techniques which are broadly categorised into two: Static Testing and Dynamic Testing.

Dynamic testing is again subdivided into two major categories:

  1. White box testing  or Structure based testing
  2. Black box testing or Specification based testing

Black Box Testing:

Let’s start with real time example. You go to an electronic shop to purchase a Mobile. Before purchase, you will perform some basic and important checks as below:

  1. You will insert a sim to check if network comes.
  2. You are able to make a call and receive a call.
  3. You are able to hear voice properly.
  4. Phone should be charged when plug in to a charger.

Did you open mobile components e.g. Circuits, receivers etc and check whether all internal components are working fine? No. You are just concerned whether a mobile is working as expected without concerning about how it does.

So the testing done above is nothing but a black box testing technique.

As per ISTQB, In ‘black-box’ or input/output driven testing techniques, a software tester view the software as a black-box with inputs and outputs, but they have no knowledge of how the system or component is structured inside the box. In essence, the tester is concentrating on what the software does, not how it does it.

Lets; see an example in Software industry.

Suppose you have got an application which allows a patient to register by providing all details. As part of black box testing, you launch the application, provide all details and register a patient. On successful registration you get a confirmation message. You are done. You don’t bother how internally it is done or what logic is being used. You are more concerned about final output which should be as per requirements. If not, you raise a bug.

Black box testing includes both functional and non-functional testing.

There are four techniques inside black box testing which helps you in designing test cases:

  1. equivalence partitioning
  2. Boundary value analysis
  3. Decision tables
  4. State transition testing

White Box Testing:

Consider the same real time example given in Black box testing. Suppose you are in a mobile manufacturing company. To develop a well functioning mobile device, you need to check all internal components. You are more concerned about how making or receiving a call will work internally rather than just pressing button.  You test all receivers, chips design, layout etc. If something is not working, you can fix then and there before end user catches it by performing black box testing.

So in the same way, a white box tester or developer understands the internal working of software to test the functionality. They check logics whether it is written correctly and performing which is expected.  It is also called as Glass box testing as you need to see internal components of software to perform testing. It is performed to test code coverage, branch coverage, quality of code etc. It is performed to check conditional statements and decision statements like loops, if , if-else etc.

Difference between Black box and white box testing:

Black Box TestingWhite Box Testing
Testing is performed on application with no or very less information about internal working logic of application. Testing is performed on application internal working logic, codes, implementation and algorithms.
It is done to verify application is working as per requirements.It is done to check developed code is logically and programmatically correct and handling all required conditions, coverage etc.
It is done by keeping application as a testing object. It is done by keeping source code as a testing object.
Integration, System testing, regression etc are examples of black box testing.Unit testing is a kind of white box testing.
It is done by Software testers.It is done by white box testers or developers.
Objective of this testing is to ensure requirements are met and report defect if not.Objective of this testing to find more defects in logic and codes or internal working before it is caught in black box testing.
Defects found in black box testing might take more time and effort to fix. Defect found in white box testing can be fixed quickly then and there.
No programming knowledge is required if you do manual testing. Programming knowledge is required if automation testing is done.Programming knowledge is must for white box testing.
Quality of code can not be tested in this. Quality of code can be tester here.

If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.

#ThanksForReading
#HappyTesting