Enroll in Selenium Training

What is White Box Testing?

White Box Testing : It is the testing method in which internal codes & structure of the software is known to the tester. The tester chooses inputs and exercises the test by giving inputs to the system through the codes and determines the appropriate outputs. The main focus of WBT is on strengthening the security and on improving the design and usability of the software.

For this, the tester is supposed to have the knowledge of programming languages and implementation of codes. The tester should be aware of the security concerns of the project and his job is to prevent the attacks from users & hackers which may inject malicious code into the software either intentionally or unintentionally. The White Box Testing is like the working of a car mechanic who knows all the internals of the car and checks why it is not working or giving less mileage etc.

White Box Testing is also known as Glass Box Testing, Clear Box Testing, Open Box Testing, Logic Driven Testing, Path Driven Testing or Structural Testing.

Definition by ISTQB

White-Box Testing: Testing based on an analysis of the internal structure of the component or system.

White-Box Test Design Technique: Procedure to derive and/or select test cases based on an analysis of the internal structure of a component or system.

Steps to White Box Testing:

Understanding the source code: The first job of the tester is to understand the source code and the structure of the software. For this, tester must have knowledge of programming languages and other tools & techniques used to develop the software that is being tested.

Create tests and execute: In this step, tester tests the source code of the application for proper flow and structure. This involves actual writing of test cases based on codes & structure and actual execution of the test cases to cover almost 100% test coverage of software application.

White Box Testing Techniques:

  1. Statement Coverage - It is aimed at exercising all programming statements with minimal tests.
  2. Branch Coverage - Running a series of tests to ensure that all branches are tested at least once.
  3. Path Coverage - Testing all possible paths which means that each statement and branch is covered.

Types of White Box Testing

Unit Testing

It is often the first type of testing done on an application. Unit testing is performed on each unit or block of code as it is developed. Unit testing is essentially done by the programmer. As a software developer, he develops a few lines of code, and test it to make sure that it works before moving ahead. Unit testing helps in identifying majority of bugs in the early stages of the testing so they are cheaper and easy to fix.

Testing for Memory Leaks

Memory leaks are the leading causes of slower running applications. A QA specialist who is experienced at detecting memory leaks is essential in cases where you have a slow running software application. There are many tools available to assist developers/testers with memory leak testing, example, Rational Purify for windows application.

Advantages & Disadvantages of White Box Testing


  • Testing is more thorough, as it covers all possible paths of code.
  • As the tester is aware of internal coding structure, then it is helpful to decide which type of input data is needed for testing software applications effectively.
  • White Box Testing allows you to help in the code optimization.


  • As a highly skilled resource is required to carry out testing who know the deep knowledge of internal structure of the code, the cost is high.
  • If the application under test is large in size, then exhaustive testing is impossible.
  • It is not possible for testing to test each and every path/condition of software program, which might miss the defects in code.
  • As each and every path is tested, it is very expensive type of testing.
Black Box Testing
Black Box Testing
Previous Article
Gray Box Testing
Gray Box Testing
Next Article
Lakshay Sharma
I’M LAKSHAY SHARMA AND I’M FULL STACK TEST AUTOMATION ENGINEER. Have passed 12 years playing with automation in mammoth projects like O2 (UK), Sprint (US), TD Bank (CA), Canadian Tire (CA), NHS (UK) & ASOS(UK). Currently I am working with KNAB bank as SDET. I am passionate about designing Automation Frameworks that follow OOPS concepts and Design patterns. https://www.linkedin.com/in/lakshay-sharma-a4216312/
Virender Singh's Photo
Virender Singh

Similar Articles