SlideShare a Scribd company logo
Software Testing Foundations #5
Dynamic Analysis. White Box Testing.
Nikita Knysh
nknysh@gmail.com
http://www.facebook.com/groups/istqb/
Agenda
• White Box Testing Overview
• White Box Testing Techniques
  ▫   Statement Coverage
  ▫   Branch Coverage
  ▫   Branch Condition Testing
  ▫   Branch Condition Combination Testing
  ▫   Condition Determination Testing
  ▫   Path Coverage
• More about White Box Testing
White Box Testing Overview #1
• Aka Code-based testing, aka structural testing
• The source code is known and used for test design (is
  the basis for white box techniques).
• Internal processing of the test object as well as the
  output is analyzed – Point of Observation (PoO) is
  inside the test object. Point of Control (PoC) is
  outside or inside the test object.
White Box Testing Overview #2
• Test cases are designed to cover the program
  structure of the test object.
• All code should be executed.
• In certain cases, it must be possible to manipulate
  the code, i.e. add code to it.
• Expected results should be defined using
  specifications, NOT the code!
• Usually applied in the lower test levels (i.e.
  component or integration test).
Technique: Statement Coverage #1
• Test cases should execute a certain quota (or all)
  statements in the test object.
Technique: Statement Coverage #2
• If sequences of unconditional statements appear in
  the program fragment then they are illustrated as
  one single node because execution of the first
  statement of the sequence guarantees that all
  following statements will be executed.
• Conditional statements (IF, CASE) and loops (WHILE;
  FOR) have more than one edge going out from them.
Technique: Statement Coverage #3
       Statement coverage =
             (number of executed
             statements / total number of statements)
             * 100 %
• Is also known as C0-coverage. Measured with
  automated tools.
• Value: unreachable code (dead statements) can be
  detected, empty ELSE-parts are not considered
  (cannot detect missing statements after ELSE) – not
  really an advantage.
Technique: Branch Coverage #1
• Aka decision coverage
• Execution of decisions is considered.

                            The following test cases are needed:
                            • a, b, f, g, h, d, e
                            • a, b, c, d, e
                            • a, b, f, g, i, g, h, d, e
                            • a, k, e
Technique: Branch Coverage #2
• Edges of the graph are the center of attention (all of
  them should be covered
• It is okay to test an edge more than once as it is not
  always possible to avoid this).
• Testing should make sure every decision is executed
  with both possible outcomes (FALSE and TRUE).
• Empty ELSE-parts are considered (every IF should be
  tested for FALSE, even if it has no ELSE).
Technique: Branch Coverage #3
        Branch coverage = (number of executed
        branches / total number of branches) * 100 %
•   Each of the branches is regarded separately and no
    particular combination of single branches is required.
•   Also known as C1-coverage. Test cost is higher for higher
    coverage requirements.
•   Value: 100 % branch coverage guarantees 100%
    statement coverage, but not vice versa. Thus, branch
    coverage is a stronger criterion.
•   Inadequate for object-oriented systems.
Technique: Branch Condition Testing
• Condition contains logical operators. Complexity of
  conditions should be taken into account.
• The goal is that each atomic (partial) condition shall
  adopt the values TRUE and FALSE.
• This is a weak criterion (weaker than statement or
  branch coverage). Should be abandoned for complex
  conditions.
Technique: Branch Condition Combination
Testing #1
(Aka multiple-condition coverage).
• Requires that all true-false combinations of atomic
  conditions be exercised at least once:
     x=6 (T), y=3 (T), x>3 OR y<5 (T)
     x=6 (T), y=8 (F), x>3 OR y<5 (T)
     x=2 (F), y=3 (T), x>3 OR y<5 (T)
     x=2 (F), y=8 (F), x>3 OR y<5 (F)
Technique: Branch Condition Combination
Testing #2
• The complete condition gives both logical results so
  this technique meets the criteria of statement and
  branch coverage.
• But it is expensive: number of combinations is 2n
  with n atomic parts of the condition.
• Also, not all combinations can be implemented with
  test data, for instance for 3<=x and x<5, combination
  FALSE – FALSE is not possible.
Technique: Condition Determination
Testing #1
• Based on the idea of restriction of combinations.
• Combinations to be considered: only those where
  modification of logical value of an atomic
  combination can change the logical value of the
  whole expression.
• If it cannot, then failure of an atomic condition will
  not reveal a defect so the test can be left out.
Technique: Condition Determination
Testing #2
• Example:
      x=6 (T), y=3 (T), x>3 OR y<5 (T) – can be left out
      x=6 (T), y=8 (F), x>3 OR y<5 (T) – should be tested
      x=2 (F), y=3 (T), x>3 OR y<5 (T) – should be tested
      x=2 (F), y=8 (F), x>3 OR y<5 (F) – should be tested

Underlined: Value that can change logical value of entire
expression if modified.
Technique: Condition Determination
Testing #3
• The number of combinations lies between n+1 and 2n
  with n = number of the Boolean operands of the
  condition, which is considerably smaller that in condition
  combination test.
• Should be used for complex conditions.
• Leads to statement and branch coverage, so no need to
  use them additionally.
• It is reasonable to try to achieve 100% coverage as
  complex conditions are often defect-prone.
• However, it may be very expensive to choose input data
  for test cases. Intensive test of complex conditions can
  be omitted if they were a subject for a review.
Technique: Path Coverage #1
• If the test object includes loops or
  repetitions, previous techniques are not sufficient.
• Path coverage requires execution of all different
  paths through the test object.
• It is obvious that 100% path coverage is not feasible
  in a program as soon as the program is not trivial.
Technique: Path Coverage #2
                   6 test cases are possible (3 before
                   edge j multiplied by 2 after edge j) if
                   conditions are independent from each
                   other and edges can be combined
                   freely.
                   • a, b, c, j, k, l, n
                   • a, d, e, f, i, j, k, l, n
                   • a, d, g, h, i, j, k, l, n
                   • a, b, c, j, m, n
                   • a, d, e, f, i, j, m, n
                   • a, d, g, h, i, j, m, n
Further White Box Testing Techniques
• Data flow based techniques primarily verify data
  usages in the test object: use of variables, read-write
  access of variables. These techniques may find faults
  where a value given to a variable in one place leads
  to failure at another place it is used.
More on White Box Techniques
• Basis for all white box techniques is the source code.
• White box techniques are useful at the lower test
  levels.
• Missing implementation of requirements is
  impossible to find for white box techniques.
Tool Support
• Manual white box testing is too resource consuming
  and error-prone.
• Instrumentation often works this way: The tool
  inserts counters in the program and initializes them
  with zero. During program execution, the counters
  are incremented when they are passed. At the end of
  the test execution, the counters contain the number
  of passes through the according program fragments.
  If a counter stayed zero during the test then the
  according program fragment has not been executed.
Thank you!




       http://www.facebook.com/groups/istqb/

More Related Content

What's hot (20)

PPTX
Control statement-Selective
Nurul Zakiah Zamri Tan
 
PPTX
EquivalencePartition
swornim nepal
 
PPT
Testing foundations
Neha Singh
 
PPTX
Test design techniques
Oksana
 
PDF
System Testing of Timing Requirements based on Use Cases and Timed Automata
Lionel Briand
 
PPTX
Test design techniques
Bipul Roy Bpl
 
PDF
Extracting Domain Models from Natural-Language Requirements: Approach and Ind...
Lionel Briand
 
PDF
A Search-based Testing Approach for XML Injection Vulnerabilities in Web Appl...
Lionel Briand
 
PPT
The Three Basic Selection Structures in C++ Programming Concepts
Tech
 
PPTX
Control Statements in Java
Niloy Saha
 
PPT
Bounded Model Checking
Ilham Amezzane
 
PDF
20041113 A Test Generation Tool for Specifications in the Form of State Machine
Will Shen
 
PPT
Control structure
Samsil Arefin
 
PPTX
Orthogonal array
ATUL RANJAN
 
PDF
Improving Fault Localization for Simulink Models using Search-Based Testing a...
Lionel Briand
 
PPTX
Chapter 2: Elementary Programming
Eric Chou
 
PPTX
Control statements in java
Manojkumar C
 
PPT
Control structures selection
Online
 
PPTX
Blackbox
Oana Feidi
 
Control statement-Selective
Nurul Zakiah Zamri Tan
 
EquivalencePartition
swornim nepal
 
Testing foundations
Neha Singh
 
Test design techniques
Oksana
 
System Testing of Timing Requirements based on Use Cases and Timed Automata
Lionel Briand
 
Test design techniques
Bipul Roy Bpl
 
Extracting Domain Models from Natural-Language Requirements: Approach and Ind...
Lionel Briand
 
A Search-based Testing Approach for XML Injection Vulnerabilities in Web Appl...
Lionel Briand
 
The Three Basic Selection Structures in C++ Programming Concepts
Tech
 
Control Statements in Java
Niloy Saha
 
Bounded Model Checking
Ilham Amezzane
 
20041113 A Test Generation Tool for Specifications in the Form of State Machine
Will Shen
 
Control structure
Samsil Arefin
 
Orthogonal array
ATUL RANJAN
 
Improving Fault Localization for Simulink Models using Search-Based Testing a...
Lionel Briand
 
Chapter 2: Elementary Programming
Eric Chou
 
Control statements in java
Manojkumar C
 
Control structures selection
Online
 
Blackbox
Oana Feidi
 

Similar to Software Testing Foundations Part 5 - White Box Testing (20)

PPS
Testing techniques
RaginiRohatgi
 
PPT
white box testing.ppt
VISHNUSHANKARSINGH3
 
PPT
2. Lect 27 to 28 White box s/w testing.ppt
KomalSinghGill
 
PDF
Lecture 06 - 07 - 08 - Test Techniques - Whitebox Testing.pdf
mkhawar5
 
PPTX
whiteboxtestingppt download here information on software.pptx
aaminashaikh053
 
PPTX
Structural testing
Slideshare
 
PPTX
Test design techniques: Structured and Experienced-based techniques
Khuong Nguyen
 
PPTX
White Box Testing
MariamKhan120
 
PPT
Whitebox
Oana Feidi
 
PPT
Unit 2 Unit level testing.ppt
PerfectMe2
 
PPSX
White Box testing by Pankaj Thakur, NITTTR Chandigarh
Pankaj Thakur
 
PPT
New software testing-techniques
Fincy V.J
 
PDF
Tools and techniques of code coverage testing
IAEME Publication
 
PPT
Whitebox testing
Oana Feidi
 
PPTX
Whitebox Testing,Types,Different techniques
vasukir11
 
PDF
Test Automation Day 2018
Maurício Aniche
 
PPTX
ScioTalks | Coverage Based Testing
Scio Consulting
 
PPT
Seii unit6 software-testing-techniques
Ahmad sohail Kakar
 
PPTX
SE UNIT 5 part 2 (1).pptx
PraneethBhai1
 
PDF
Software Engineering : Software testing
Ajit Nayak
 
Testing techniques
RaginiRohatgi
 
white box testing.ppt
VISHNUSHANKARSINGH3
 
2. Lect 27 to 28 White box s/w testing.ppt
KomalSinghGill
 
Lecture 06 - 07 - 08 - Test Techniques - Whitebox Testing.pdf
mkhawar5
 
whiteboxtestingppt download here information on software.pptx
aaminashaikh053
 
Structural testing
Slideshare
 
Test design techniques: Structured and Experienced-based techniques
Khuong Nguyen
 
White Box Testing
MariamKhan120
 
Whitebox
Oana Feidi
 
Unit 2 Unit level testing.ppt
PerfectMe2
 
White Box testing by Pankaj Thakur, NITTTR Chandigarh
Pankaj Thakur
 
New software testing-techniques
Fincy V.J
 
Tools and techniques of code coverage testing
IAEME Publication
 
Whitebox testing
Oana Feidi
 
Whitebox Testing,Types,Different techniques
vasukir11
 
Test Automation Day 2018
Maurício Aniche
 
ScioTalks | Coverage Based Testing
Scio Consulting
 
Seii unit6 software-testing-techniques
Ahmad sohail Kakar
 
SE UNIT 5 part 2 (1).pptx
PraneethBhai1
 
Software Engineering : Software testing
Ajit Nayak
 
Ad

More from Nikita Knysh (8)

PPTX
Overview of test process improvement frameworks
Nikita Knysh
 
PPTX
Fundamental Test Process New
Nikita Knysh
 
PPTX
Software Testing Foundations Part 7 - Basics of Test Management
Nikita Knysh
 
PPTX
Software Testing Foundations Part 8 - Test Tools
Nikita Knysh
 
PPTX
Software Testing Foundations Part 4 - Black Box Testing
Nikita Knysh
 
PPTX
Software Testing Foundations Part 6 - Intuitive and Experience-based testing
Nikita Knysh
 
PPTX
Software Testing Foundations Part 2 - Testing in Software Lifecycle
Nikita Knysh
 
PPTX
ACC presentation for QA Club Kiev
Nikita Knysh
 
Overview of test process improvement frameworks
Nikita Knysh
 
Fundamental Test Process New
Nikita Knysh
 
Software Testing Foundations Part 7 - Basics of Test Management
Nikita Knysh
 
Software Testing Foundations Part 8 - Test Tools
Nikita Knysh
 
Software Testing Foundations Part 4 - Black Box Testing
Nikita Knysh
 
Software Testing Foundations Part 6 - Intuitive and Experience-based testing
Nikita Knysh
 
Software Testing Foundations Part 2 - Testing in Software Lifecycle
Nikita Knysh
 
ACC presentation for QA Club Kiev
Nikita Knysh
 
Ad

Recently uploaded (20)

PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 

Software Testing Foundations Part 5 - White Box Testing

  • 1. Software Testing Foundations #5 Dynamic Analysis. White Box Testing. Nikita Knysh [email protected] http://www.facebook.com/groups/istqb/
  • 2. Agenda • White Box Testing Overview • White Box Testing Techniques ▫ Statement Coverage ▫ Branch Coverage ▫ Branch Condition Testing ▫ Branch Condition Combination Testing ▫ Condition Determination Testing ▫ Path Coverage • More about White Box Testing
  • 3. White Box Testing Overview #1 • Aka Code-based testing, aka structural testing • The source code is known and used for test design (is the basis for white box techniques). • Internal processing of the test object as well as the output is analyzed – Point of Observation (PoO) is inside the test object. Point of Control (PoC) is outside or inside the test object.
  • 4. White Box Testing Overview #2 • Test cases are designed to cover the program structure of the test object. • All code should be executed. • In certain cases, it must be possible to manipulate the code, i.e. add code to it. • Expected results should be defined using specifications, NOT the code! • Usually applied in the lower test levels (i.e. component or integration test).
  • 5. Technique: Statement Coverage #1 • Test cases should execute a certain quota (or all) statements in the test object.
  • 6. Technique: Statement Coverage #2 • If sequences of unconditional statements appear in the program fragment then they are illustrated as one single node because execution of the first statement of the sequence guarantees that all following statements will be executed. • Conditional statements (IF, CASE) and loops (WHILE; FOR) have more than one edge going out from them.
  • 7. Technique: Statement Coverage #3 Statement coverage = (number of executed statements / total number of statements) * 100 % • Is also known as C0-coverage. Measured with automated tools. • Value: unreachable code (dead statements) can be detected, empty ELSE-parts are not considered (cannot detect missing statements after ELSE) – not really an advantage.
  • 8. Technique: Branch Coverage #1 • Aka decision coverage • Execution of decisions is considered. The following test cases are needed: • a, b, f, g, h, d, e • a, b, c, d, e • a, b, f, g, i, g, h, d, e • a, k, e
  • 9. Technique: Branch Coverage #2 • Edges of the graph are the center of attention (all of them should be covered • It is okay to test an edge more than once as it is not always possible to avoid this). • Testing should make sure every decision is executed with both possible outcomes (FALSE and TRUE). • Empty ELSE-parts are considered (every IF should be tested for FALSE, even if it has no ELSE).
  • 10. Technique: Branch Coverage #3 Branch coverage = (number of executed branches / total number of branches) * 100 % • Each of the branches is regarded separately and no particular combination of single branches is required. • Also known as C1-coverage. Test cost is higher for higher coverage requirements. • Value: 100 % branch coverage guarantees 100% statement coverage, but not vice versa. Thus, branch coverage is a stronger criterion. • Inadequate for object-oriented systems.
  • 11. Technique: Branch Condition Testing • Condition contains logical operators. Complexity of conditions should be taken into account. • The goal is that each atomic (partial) condition shall adopt the values TRUE and FALSE. • This is a weak criterion (weaker than statement or branch coverage). Should be abandoned for complex conditions.
  • 12. Technique: Branch Condition Combination Testing #1 (Aka multiple-condition coverage). • Requires that all true-false combinations of atomic conditions be exercised at least once: x=6 (T), y=3 (T), x>3 OR y<5 (T) x=6 (T), y=8 (F), x>3 OR y<5 (T) x=2 (F), y=3 (T), x>3 OR y<5 (T) x=2 (F), y=8 (F), x>3 OR y<5 (F)
  • 13. Technique: Branch Condition Combination Testing #2 • The complete condition gives both logical results so this technique meets the criteria of statement and branch coverage. • But it is expensive: number of combinations is 2n with n atomic parts of the condition. • Also, not all combinations can be implemented with test data, for instance for 3<=x and x<5, combination FALSE – FALSE is not possible.
  • 14. Technique: Condition Determination Testing #1 • Based on the idea of restriction of combinations. • Combinations to be considered: only those where modification of logical value of an atomic combination can change the logical value of the whole expression. • If it cannot, then failure of an atomic condition will not reveal a defect so the test can be left out.
  • 15. Technique: Condition Determination Testing #2 • Example: x=6 (T), y=3 (T), x>3 OR y<5 (T) – can be left out x=6 (T), y=8 (F), x>3 OR y<5 (T) – should be tested x=2 (F), y=3 (T), x>3 OR y<5 (T) – should be tested x=2 (F), y=8 (F), x>3 OR y<5 (F) – should be tested Underlined: Value that can change logical value of entire expression if modified.
  • 16. Technique: Condition Determination Testing #3 • The number of combinations lies between n+1 and 2n with n = number of the Boolean operands of the condition, which is considerably smaller that in condition combination test. • Should be used for complex conditions. • Leads to statement and branch coverage, so no need to use them additionally. • It is reasonable to try to achieve 100% coverage as complex conditions are often defect-prone. • However, it may be very expensive to choose input data for test cases. Intensive test of complex conditions can be omitted if they were a subject for a review.
  • 17. Technique: Path Coverage #1 • If the test object includes loops or repetitions, previous techniques are not sufficient. • Path coverage requires execution of all different paths through the test object. • It is obvious that 100% path coverage is not feasible in a program as soon as the program is not trivial.
  • 18. Technique: Path Coverage #2 6 test cases are possible (3 before edge j multiplied by 2 after edge j) if conditions are independent from each other and edges can be combined freely. • a, b, c, j, k, l, n • a, d, e, f, i, j, k, l, n • a, d, g, h, i, j, k, l, n • a, b, c, j, m, n • a, d, e, f, i, j, m, n • a, d, g, h, i, j, m, n
  • 19. Further White Box Testing Techniques • Data flow based techniques primarily verify data usages in the test object: use of variables, read-write access of variables. These techniques may find faults where a value given to a variable in one place leads to failure at another place it is used.
  • 20. More on White Box Techniques • Basis for all white box techniques is the source code. • White box techniques are useful at the lower test levels. • Missing implementation of requirements is impossible to find for white box techniques.
  • 21. Tool Support • Manual white box testing is too resource consuming and error-prone. • Instrumentation often works this way: The tool inserts counters in the program and initializes them with zero. During program execution, the counters are incremented when they are passed. At the end of the test execution, the counters contain the number of passes through the according program fragments. If a counter stayed zero during the test then the according program fragment has not been executed.
  • 22. Thank you! http://www.facebook.com/groups/istqb/