0% found this document useful (0 votes)
13 views

White Box Testing in Software Engineering

Uploaded by

venkat Mohan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

White Box Testing in Software Engineering

Uploaded by

venkat Mohan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

WHITE BOX TESTING IN

SOFTWARE ENGINEERING

Understanding the Concepts, Techniques, and


Importance
WHAT IS SOFTWARE
TESTING?
• Definition: Software testing is the process of evaluating and
verifying that a software application or system meets specified
requirements and functions correctly.
• Why is it Important?
• Quality Assurance: Ensures software reliability, performance,
and security.
• Bug Detection: Identifies and resolves errors early in
development.
• Cost-Efficiency: Reduces long-term costs by preventing
defects.
• User Satisfaction: Enhances end-user experience by
improving software stability and functionality.
WHAT IS WHITE BOX
TESTING?
• Definition: White Box Testing (also called Clear Box or
Structural Testing) is a software testing technique where the
tester has access to the internal structure, design, and code of
the software.
• Key Focus: Testing the internal logic, code paths, and
structure of the program.
• Goal: To ensure that the code functions as expected and that
all possible paths and branches are covered.
TYPES OF WHITE BOX
TESTING
 Unit Testing : Checks if each part or function of the application
works correctly.

• Ensures the application meets design requirements during


development.

 Integration Testing: Examines how different parts of the


application work together.

• Done after unit testing to make sure components work well both
alone and together.

 Regression Testing: Verifies that changes or updates don’t break


existing functionality.
WHITE BOX TESTING
TECHNIQUES
• Statement Coverage: Ensures that every statement in the code is
executed at least once.
• Branch Coverage: Ensures that every branch (e.g., if-else) is tested.
• Path Coverage: Ensures that all possible execution paths through the
code are tested.
• Condition Coverage: Ensures that each condition in the code has been
evaluated both to true and false.
 Loop Testing: Loops are widely used and these are fundamental to
many algorithms hence, their testing is very important. Errors often
occur at the beginnings and ends of loops.
Statement Coverage
Branch Coverage
• Simple loops: For simple loops of size n, test cases are designed that:

1.Skip the loop entirely

2.Only one pass through the loop

3.2 passes

4.m passes, where m < n

5.n-1 ans n+1 passes

• Nested loops: For nested loops, all the loops are set to their minimum
count, and we start from the innermost loop. Simple loop tests are
conducted for the innermost loop and this is worked outwards till all the
loops have been tested.

• Concatenated loops: Independent loops, one after another. Simple


loop tests are applied for each. If they’re not independent, treat them
TOOLS FOR WHITE BOX
TESTING
• JUnit (for Java)
• NUnit (for .NET)
• PyTest (for Python)
• CUnit (for C)
• SonarQube: For static code analysis to identify code quality issues.
• JaCoCo: A code coverage tool for Java.
ADVANTAGES OF WHITE BOX TESTING
1.Thorough Testing : White box testing is thorough as the entire code and
structures are tested.

2.Code Optimization: It results in the optimization of code removing errors and


helps in removing extra lines of code.

3.Early Detection of Defects: It can start at an earlier stage as it doesn’t require


any interface as in the case of black box testing.

4.Integration with SDLC: White box testing can be easily started in Software
Development Life Cycle.

5.Detection of Complex Defects: Testers can identify defects that cannot be


detected through other testing techniques.

6.Comprehensive Test Cases: Testers can create more comprehensive and


effective test cases that cover all code paths.
DISADVANTAGES OF WHITE BOX TESTING
1.Programming Knowledge and Source Code Access: Testers need
to have programming knowledge and access to the source code to
perform tests.

2.Overemphasis on Internal Workings: Testers may focus too much


on the internal workings of the software and may miss external issues.

3.Bias in Testing: Testers may have a biased view of the software since
they are familiar with its internal workings.

4.Test Case Overhead: Redesigning code and rewriting code needs test
cases to be written again.

5.Dependency on Tester Expertise: Testers are required to have in-


depth knowledge of the code and programming language as opposed to
black-box testing.
WHITE BOX TESTING
PROCESS
1.Input: Requirements, Functional specifications, design documents,
source code.

2.Processing: Performing risk analysis to guide through the entire


process.

3.Proper test planning: Designing test cases to cover the entire code.
Execute rinse-repeat until error-free software is reached. Also, the results
are communicated.

4.Output: Preparing the final report of the entire testing process.


CONCLUSION
• White Box Testing provides a deep insight into the internals of a
program.
• It is crucial for testing the logic, structure, and efficiency of the code.
• Despite its challenges, white box testing complements other testing
techniques like black-box testing to ensure comprehensive software
quality.
 White Testing is performed in 2 Steps

1.Tester should understand the code well

2.Tester should write some code for test cases and execute them

You might also like