UNIVERSITY INSTITUTE OF COMPUTING
UNIT-3
Bachelor of Computer Applications
Software Engineering
(21CAT-312/21SCT-312/22CAT-213/22SCT-213)
DISCOVER . LEARN . EMPOWER
Topics to be covered
• Introduction of White Box Testing
• Working process of White Box Testing
• How to Perform White Box Testing?
• White box Testing Techniques
• Generic Steps of White Box Testing
• Advantages and Disadvantages
White Box Testing Introduction
• White box testing techniques analyze the internal structures the used data
structures, internal design, code structure, and the working of the software rather
than just the functionality as in black box testing. It is also called glass box testing
or clear box testing or structural testing. White Box Testing is also known as
transparent testing or open box testing.
• White box testing is a software testing technique that involves testing the internal
structure and workings of a software application. The tester has access to the
source code and uses this knowledge to design test cases that can verify the
correctness of the software at the code level.
• White box testing is also known as structural testing or code-based testing, and it
is used to test the software’s internal logic, flow, and structure. The tester creates
test cases to examine the code paths and logic flows to ensure they meet the
specified requirements.
White Box Testing
Working process of White Box Testing
• Input: Requirements, Functional specifications, design documents, source code.
• Processing: Performing risk analysis to guide through the entire process.
• Proper test planning: Designing test cases so as to cover the entire code. Execute
rinse-repeat until error-free software is reached. Also, the results are
communicated.
• Output: Preparing final report of the entire testing process.
How to Perform Testing?
• We have divided it into two basic steps to give you a simplified explanation of
white box testing. This is what testers do when testing an application using the
white box testing technique:
• STEP 1) UNDERSTAND THE SOURCE CODE
• The first thing a tester will often do is learn and understand the source code of the
application. Since white box testing involves the testing of the inner workings of
an application, the tester must be very knowledgeable in the programming
languages used in the applications they are testing.
• Also, the testing person must be highly aware of secure coding practices. Security
is often one of the primary objectives of testing software. The tester should be
able to find security issues and prevent attacks from hackers and naive users who
might inject malicious code into the application either knowingly or unknowingly.
How to Perform Testing?
• STEP 2) CREATE TEST CASES AND EXECUTE
• The second basic step to white box testing involves testing the application’s
source code for proper flow and structure. One way is by writing more code to test
the application’s source code.
• The tester will develop little tests for each process or series of processes in the
application. This method requires that the tester must have intimate knowledge of
the code and is often done by the developer. Other methods include
Manual Testing, trial, and error testing and the use of testing tools
White Box Testing Techniques
• Statement Coverage: Statement coverage testing ensures that every line of code
within an application is tested by at least one test case. Statement coverage testing
can help to identify if portions of the code are unused or unreachable, which can
be caused by programming errors, updates, etc. Identifying this dead code enables
developers to fix incorrect conditional statements or remove redundant code to
improve application performance and security.
• Branch Coverage: Conditional statements create branches within an application’s
execution code as different inputs can follow different execution paths. Branch
coverage testing ensures that every branch within an application is covered by unit
testing. This ensures that even little-used code paths are properly validated.
• Path Coverage: An execution path describes the sequence of instructions that can
be executed from when an application starts to where it terminates. Path coverage
testing ensures that every execution path through an application is covered by use
cases. This can help to ensure that all execution paths are functional, efficient, and
necessary.
Generic Steps of White Box Testing
• Design all test scenarios, test cases and prioritize them according to high priority
number.
• This step involves the study of code at runtime to examine the resource utilization,
not accessed areas of the code, time taken by various methods and operations and
so on.
• In this step testing of internal subroutines takes place. Internal subroutines such as
nonpublic methods, interfaces are able to handle all types of data appropriately or
not.
• This step focuses on testing of control statements like loops and conditional
statements to check the efficiency and accuracy for different data inputs.
• In the last step white box testing includes security testing to check all possible
security loopholes by looking at how the code handles security.
Reasons for White Box Testing
• It identifies internal security holes.
• To check the way of input inside the code.
• Check the functionality of conditional loops.
• To test function, object, and statement at an individual level.
Advantages
• White box testing optimizes code so hidden errors can be identified.
• Test cases of white box testing can be easily automated.
• This testing is more thorough than other testing approaches as it covers all code
paths.
• It can be started in the SDLC phase even without GUI.
Disadvantages
• White box testing is too much time consuming when it comes to large-scale
programming applications.
• White box testing is much expensive and complex.
• It can lead to production error because it is not detailed by the developers.
• White box testing needs professional programmers who have a detailed
knowledge and understanding of programming language and implementation.