EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 600+ Courses All in One Bundle
  • Login
Home Software Development Software Development Tutorials Software Testing Tutorial White Box Testing
Secondary Sidebar
Software Testing Tutorial
  • Types of Testing
    • Adhoc Testing
    • Types of System Testing
    • Manual Testing Types
    • Unit Testing Types
    • Unit Testing Benefits
    • Agile Testing
    • What is Agile Testing
    • Acceptance Testing
    • Stress Testing Types
    • Alpha and Beta Testing
    • Application Testing
    • Automation Testing
    • Automation Testing Advantages
    • Benchmark Testing
    • Black Box Testing
    • Domain Testing
    • Dynamic Testing
    • Ecommerce Testing
    • Fuzz Testing
    • Gray Box Testing
    • GUI Testing
    • Installation Testing
    • Interface Testing
    • Interoperability Testing
    • Mainframe Testing
    • Manual Testing
    • Mutation Testing
    • Monkey Testing
    • Negative Testing
    • Penetration Testing
    • Penetration testing phases
    • Penetration testing framework
    • Protocol Testing
    • Recovery Testing
    • Regression Testing
    • Mobile Penetration Testing
    • Accessibility Testing
    • Sanity Testing
    • Scalability Testing
    • Security Testing
    • Spike Testing
    • Stability Testing
    • State Transition Testing
    • Static Testing
    • Gatling Load Testing
    • System Integration Testing
    • Structural Testing
    • Locust Load Testing
    • System Testing
    • Control Flow Testing
    • Unit Testing
    • Cypress testing
    • Volume Testing
    • Web Testing Application
    • What is Exploratory Testing
    • What is Stress Testing
    • What is Usability Testing
    • White Box Testing
    • Types of White Box Testing
    • Compatibility Testing?
    • Use Case Testing
    • Beta Testing
    • Integration Testing
    • Non Functional Testing
    • Non Functional Testing Types
    • What is Functional Testing
    • Functional testing types
    • Cookie Testing
    • Alpha Testing
    • Boundary Value Testing
    • Equivalence Class Testing
    • Glass Box Testing
    • SOA Testing
    • Smoke Testing
    • Visual Testing
    • Visual Paradigm
    • Model-Based Testing
  • Basics
    • What is Software Testing
    • Careers in Software Testing
    • Defect Life Cycle in Software Testing
    • Bug Life Cycle
    • Levels of Software Testing
    • Software Testing Life Cycle
    • Software Tester Work
    • Software Testing Principles
    • Software Testing Services
    • Testing Methodologies
    • Test Approaches
    • Grey Box Testing
    • Types of Software Testing
    • What is a Bug in Software Testing
    • Benefits of Automation Testing
    • What is Automation Testing?
    • Types of Automation
    • Typical Journey of a Software Tester
    • Automation Testing Process
    • Mobile Automation Testing
    • Automation Testing Life Cycle
    • Software Quality Assurance
    • Software Quality Assurance
    • What is Test Environment?
    • Verification and Validation Testing
  • Testing techniques
    • Software Testing Methodologies
    • Black Box Testing Techniques
    • Static Testing Techniques
    • Test Case Design Techniques
    • What is Static Analysis
  • Testing tools
    • Manual Testing Tools
    • Visual Testing Tools
    • Automation Testing Tools
    • Functional Testing Tools
    • GUI Testing Tools
    • Penetration Testing Tools
    • Performance Testing Tools
    • SOA Testing Tools
    • Accessibility Testing Tools
    • What is QTP
    • Regression Testing Tools
    • Security Testing Tools
    • Test Management Tools
    • Defect Management Tools
    • Code Coverage Tools
    • Test Coverage Tools
    • Defect Tracking Tools
    • Continuous Integration Tools
    • Install Bugzilla
    • Test data generation tool
    • Unit Testing Tools
    • Web Testing Tools
    • Stress Testing Tools
    • Performance Monitoring Tools
    • Mobile Testing Tools
    • Responsive Testing Tool
    • Cross Browser Testing Tools
    • Risk Based Testing
    • Database Testing Tools
    • WinRunner
    • What is Squish?
    • CubicTest
    • What is WinRM?
    • Bugzilla Tool
    • Code review tools
    • Penetration Testing Open Source Tools
  • Advance
    • Cyclomatic Complexity
    • Decision Table Testing
    • Decision Tree Algorithm
    • What is Continuous Integration
    • Mantis Bug Tracker
    • Equivalence Partitioning
    • Gantt Chart Software
    • Acceptance Testing Types
    • Load testing tools
    • Install TestNG
    • Install Unity
    • Defect Management Process
    • Test Plan Template
    • Testing Interview Questions
    • Testing of Mobile application
    • What is Test Automation Frameworks
    • Test Automation Framework
    • Application of Automation
    • Test Automation Process
    • Automation Testing Roles and Responsibilities
    • What is Instruction Cycle?
    • What is Cucumber?
    • 15 Best Popular Bug Reporting Tools
    • What is Automated Testing?
    • Software Maintenance Types
    • Types of Penetration Testing
    • Software Reliability
    • Best Gantt Chart Software
    • Code Coverage
    • Branch Coverage
    • Decision Coverage
    • Statement Coverage
    • What is Test Case
    • Types of Test Case
    • What is Test Scenario
    • Formal Review
    • Alpha Beta Pruning
    • What is Cyclomatic Complexity?
    • Test Coverage
    • How to Write Test Case
    • Testing Documentation
    • Performance Testing Life Cycle
    • Test Harness
    • Test Strategy
    • Software Incident Management
    • What is Debugging
    • What is Defect?
    • Listeners in TestNG
  • Inteview Questions
    • Automation Testing Interview Questions
    • Manual Testing Interview Questions
    • ISTQB Interview Questions
    • Cucumber Interview Questions
    • Software Testing Interview Questions
    • Penetration Testing Interview Questions

Related Courses

Software Testing Course

Penetration Training Course

TestNG Training Course

White Box Testing

By Priya PedamkarPriya Pedamkar

White Box Testing

Introduction to White Box Testing

White Box Testing or Transparent Testing is usually performed by the developer or someone who has knowledge of the coding language used in the given application. It is a process of testing the core design, build & coding database construction pattern, and implementation of a software application as a product. Verifying the program design, the programs in the form of codes, internal integration flow, and validating the database, the various combinations of input that should be permitted, the type of output expected, code modules responsible for performance and security of the application, etc., are accomplished in this testing.

What is White Box Testing?

It is also called code base testing, clear box testing, open box testing, and structural testing. The core idea of this approach to software testing is taking a look at the internal structure design and at the code of the program to test it.

In White box testing, the tester can see the entire code of the program, and he is tasked to verify the flow of how inputs and outputs work in the program. Unlike black-box testing, which is more focused on testing the functionality of the program, it is concerned with testing the internal structures of the program. Taking a look at the program in this way allows us to work on improving the design, usability and making the product more secure.

As you can guess, it is called white box or glass box testing because the tester can see the code and other parts of the program.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

What makes White Box Testing Different from Black Box Testing?

If you have been tipping your toes in testing in the past, I am sure you have come across Black Box Testing. The biggest difference between White Box Testing and Black Box Testing is that unlike Black Box testing, which is done from a user’s point of view, it is done from a developer’s Point of View. In other words, rather than taking a look at the program from the outside, this approach sees the internal code and tests it.

How is it Performed?

We can divide the process into two major steps:

1. Understanding the code provided

At first, A tester in White Box Testing will need to learn the code of the application. Considering the fact it is all about understanding and testing all the internal code of the program, anyone who is tasked with testing the code should not only have good knowledge of programming but will also be needed to have a good hand with the language of the source code. Security is one of the important aspects of it, so the tester will also have to be good at secure coding practices.

All in One Software Development Bundle(600+ Courses, 50+ projects)
Python TutorialC SharpJavaJavaScript
C Plus PlusSoftware TestingSQLKali Linux
Price
View Courses
600+ Online Courses | 50+ projects | 3000+ Hours | Verifiable Certificates | Lifetime Access
4.6 (86,502 ratings)

2. Creating test cases and executing them

Once the code has been studied by the testing team, they can start testing the code to check its proper flow and structure. To do this, the testers will write some code for some test cases, which will try to traverse through all lines of code present in the program. It can also be done in Manual testing, which involves trial and error. The testers can also use some automated testing tools such as JUnit and NUnit.

Example

To better understand the concept of White Box Testing, take a look at the code below:

Code:

print (int x, int y) {
int sum = x + y;
If ( sum > 0 )
Print ( "Positive", result )
Else
Print ( "Negative", result )
}

As we discussed earlier, the goal of it is to traverse all branches, loops, and statements that are present in the code. Considering that, we can make 2 test cases, one where both inputs are positive and another where both inputs are negative integers.

Example:

  • A = 10 and B = 20
  • A = -10 and B = -20

White Box Testing Techniques

One of the most popular testing techniques for white box testing is called code coverage analysis, this technique tries to eliminate any gaps in the test case suite, and it identifies sections of an app that are not used by test cases. Once these gaps are found, we can create cases to see and verify parts of the code that is untested; this results in a more polished product at the end.

Following are some coverage analysis techniques:

  • Statement Coverage: In this method, we try to traverse all statements in the code at least one time. This assures that all of the code is tested.
  • Branch Coverage: This method is planned to traverse each branch of the decision points in the code. This makes sure that all decisions are at least tested once.

There are some other testing techniques too, here are just a few:

  • Condition Coverage: In this testing technique, we make sure that all conditions are covered in the code, for example:

Code:

READ A, B
IF (A == 0 || B == 0)
PRINT ‘0’

As you can see, here we have 2 conditions: A == 0 and B == 0. Now, these conditions receive TRUE and FALSE as values.

One possible example can be:

#TC1 – A = 0, B = 110
#TC2 – A = 10, B = 0

  • Multiple Condition Coverage: This is a bit more advanced than the last one. As you can guess, we test all possible combinations and all possible outcomes at least once.

Example:

Code:

READ A, B
IF (A == 0 || B == 0)
PRINT ‘0’

#TC1: A = 0, B = 0
#TC2: A = 0, B = 10
#TC3: A = 110, B = 0
#TC4: A = 110, B = 5

Hence. We require 4 test cases for 2 conditions.

Hence if there are n conditions, then we will require 2n test cases.

  • Basis Path Testing: In this technique, we make a control flow graph, and then we calculate its cyclomatic complexity, which is the number of independent paths. Using the cyclomatic complexity, we can find the minimal number of test cases we can design for each independent path of the flow graph.
  • Loop Testing: Loops are one of the most used tools in a programmer’s weaponry. As these are at the core of so many algorithms, it only makes sense to have a testing technique based on loops. There can be 3 types of loops: Simple, nested, and concatenated. Let’s take a look at how a tester will deal with the tech of these types:

1. Simple Loops: For a loop that is simple in design and has the size n, we can design some test cases that do the following:

  • Skip said loop.
  • Only traverse the loop once.
  • Have 2 passes
  • Have any number of passes that is less than its size.
  • n-1 and n+1 pass through the loop.

2. Nested Loops: For code with nested loops, we start with the innermost loop and then go outwards till we can reach to the outermost loop.

3. Concatenated loops: In the case of these loops. We use a simple loop test once after another, and in case the concatenated loop is not independent, we can deal with them as we did with nested loops.

Advantages and Disadvantages of White Box Testing

Given below are the advantages and disadvantages mentioned:

Advantages:

  • It has simple and clear rules to let a tester know when the testing is done.
  • The techniques are easy to automate; this results in a developer having to hire fewer testers and smaller expenses.
  • It shows bottlenecks which makes the optimization quite easy for the programmers.
  • A testing team can get started with their work without having to wait for the development team to complete the UI development.
  • As all code paths are covered in the code in most cases, the testing of code is more thorough.
  • It helps in removing parts of the code that are not essential to the functionality of the program.

Disadvantages:

  • It is quite taxing on resources. To get the testing done, you will need someone who knows your code very well to be on the testing team and who is a good programmer himself. This type of skill level increases the expenses of the testing.
  • In many cases, being able to test every possible condition in the code is not possible due to time constraints or budget limitations.
  • As it is based on checking the functionality of the existing code, you can’t find the missing functionality in the program.
  • If any part of the code is redesigned and re-written, testers need to write the test cases again.

White Box Testing Tools

Given below are the white box testing tools:

1. JSUnit.net

This is a JavaScript testing tool. JSUnit is a part of Junit, and it’s an open-source unit testing framework that can be used to do White Box Testing. JSUnit is completely open-source under GNU Public License 2.0, which means even for commercial use, a developer does not have to pay any licensing fee.

2. CppUnit

Just like JSUnit, CppUnit is also considered to be a part of JUnit. The tool can output in plain text or XML format, depending on the tester’s need, and it can create unit tests with its own classes. The CppUnit is licensed under LGPL.

3. Veracode

While it’s not free for use, Veracode has some powerful tools that can be used to test .NET, C++, Java, and some other languages. It can be done applications made for desktop, web, and mobile apps too.

4. NUnit

It’s a unit testing framework, and it was written in C#. The tool supports all available .Net languages, and it supports data-driven tests too. Functionality-wise, it can work on both parallel and concurrent execution, and it can provide a class framework and test runner apps. One notable feature of the NUnit is that it is fairly easy to use.

5. JUnit

As you can guess from its name, JUnit is a unit testing automation tool for Java. The JUnit van is easily integrated with IDEs such as eclipse, Macen ACT, etc. It is able to support test-driven development, and it can synchronize existing tests with newly created once too. JUnit is completely open-source and free to use for any kind of Java Development.

6. CSUnit

Just like Nunit, CSUnit is built to support unit testing in the .Net Framework. It supports languages such as C# and VB.Net. CSUnit has built-in support for factoring practice and other types of practices that are used in the agile development approach of SDLC.

Conclusion

Testing has a very important place in the software development process, and White Box Testing is a valuable approach to getting it done. While this testing approach can be expensive and time-consuming, it remains to be the only way to make sure that all parts of the code were covered in the testing process.

The most important part of White Box Testing is how familiar the tester is with the code. Someone tasked with testing on the WBT approach who does not have a good hand with the source code and the programming language used will cause a lot of trouble. Also, depending only on this is not a good idea as it does not cover missing functionality. For a more covered approach to the development, both White Box Testing and Black box testing should be done as it will then cover maximum bugs, defects, and remaining features that need to be added before the product can be shipped.

Recommended Articles

This has been a guide to White Box Testing. Here we discussed how White Box Testing is performed with the help of examples and different White Box tools and techniques. You can also go through our other suggested articles to learn more –

  1. Software Testing Interview Questions
  2. Game Testing Interview Questions
  3. ETL Testing Interview Questions
  4. Software Testing Life Cycle
Popular Course in this category
Software Testing Training (11 Courses, 2 Projects)
  11 Online Courses |  2 Hands-on Projects |  65+ Hours |  Verifiable Certificate of Completion
4.5
Price

View Course

Related Courses

Penetration Testing Training Program (2 Courses)4.9
TestNG Training (4 Courses, 2 Project)4.8
0 Shares
Share
Tweet
Share
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Java Tutorials
  • Python Tutorials
  • All Tutorials
Certification Courses
  • All Courses
  • Software Development Course - All in One Bundle
  • Become a Python Developer
  • Java Course
  • Become a Selenium Automation Tester
  • Become an IoT Developer
  • ASP.NET Course
  • VB.NET Course
  • PHP Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2022 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Software Development Course

C# Programming, Conditional Constructs, Loops, Arrays, OOPS Concept

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more