SlideShare a Scribd company logo
1 of 15
SOFTWARE QUALITY
ASSURANCE
WHITE BOX




      Seminar: Oana FEIDI
      Quality Manager – Continental Automotive
BLACK-BOX VS. WHITE-BOX

                      Test cases derived from specifications




   The focus is not the design, nor the implementation
                                   The focus is on the logic of implementation
WHITE BOX (STRUCTURAL
TESTING)
 Structural - test case selection is based on an
 analysis of the internal structure of
 component

     Control flow
       Statement testing

       Branch/Decision Testing

       Branch Condition Testing

       Modified Condition Combination Testing




     Data flow testing
WHITE BOX
   Using the white-box testing techniques outlined
    in this seminar, a software engineer can design
    test cases that
        exercise independent paths within a module or unit;
        exercise logical decisions on both their true and false side;

        execute loops at their boundaries and within their

         operational bounds
        exercise internal data structures to ensure their validity
STATEMENT TESTING
   uses a model of the program’s control flow
   it is designed in order to execute all or selected statements of the
    test object
Test cases are design to execute
each statement.
                                                      An entity in a programming
For each test case specify:                            language which is typically
                                                     the smallest indivisible unit of
• the input(s) of the component                                execution.

• identification of statement(s) to be
executed by the test case
• the expected outcome of the test
case
 Test completeness criteria: the percentage of the statements in the
 software which were executed at least at once (executing a statement
 means that the statement was encountered and evaluated during testing).
EXAMPLE
 float foo (int a, int b, int c, int d, float e)
 {
    float e;
    if (a == 0) {
           return 0;
    }
    int x = 0;
    if ((a==b) OR ((c == d) AND bug(a) )) {
           x=1;
    }
    e = 1/x;
                                                 statement
    return e;
 }
BRANCH/DECISION TESTING
 uses a model of the program’s flow
 it is designed in order to execute (each) outcome
  of all or selected decision points in a test object
                                            an executable statement
    For each test specify:
                                           which may transfer control
    • the input(s) of the component          to another statement,
                                            depending upon the logic
    • Identification of decision
                                            of the decision statement
    outcome(s) to be executed by
    the test case
    • the expected outcome of the
    test case

 Test completeness criteria: achievement of the test coverage – 100%
 of the branches (one true and one false for each part of condition)
EXAMPLE
A  = true and (B or C) = false
 A = false and (B or C) = true

                                       if A and (B or C)



        Case   A   B     C    Output

        1      0   1     1    0

        2      1   0     0    0
BRANCH CONDITION COMBINATION
   uses a model of the program flow where each
    combination of the inputs for a decision/condition must
    be tested, in order to check if each branch is covered
   For each test case specify:
        the input(s) of the component
        the expected outcome of the test case which can show which

         branch is covered


Test completeness criteria: for a condition containing n
  boolean operands → 2n test cases are required to achieve
  100% coverage
Note: this coverage rapidly becomes unachievable for more
 complex conditions.
WHITE BOX - SUMMARY
 Statement     testing
     uses a model of the program’s control flow
     it is designed in order to execute all or selected statements of

      the test object
 Branch/Decision       Testing
     uses a model of the program’s flow
     it is designed in order to execute (each) outcome of all or

      selected decision points in a test object
 Branch    Condition Combination
       uses a model of the program flow where each combination
        of the inputs for a decision/condition must be tested, in
        order to check if each branch is covered
MODIFIED CONDITION COMBINATION
TESTING
 usesa model of the program’s flow where each
 atomic condition is independently tested, in order
 to show how the decision outcome is affected

 test
     case are designed to show that each condition
 independently affects the decision outcome

 For    each test case specify:
      the input(s) of the component
      The expected outcome of the test case
MODIFIED CONDITION COMBINATION
TESTING
   Test completeness criteria
       for a condition containing n boolean operands, to achieve
        100% coverage are necessary:
         minimum: n + 1 test cases
         maximum: 2n test cases




   Example: for 3 boolean operands, to achieve 100%
    coverage are necessary:
         Minimum 4 test cases
         Maximum 6 test cases
EXAMPLE
Case   A       B       B or C   C       Outcome

1          1       1      1         0      1      if (A and (B or C))

2          0                               0

3          1       1      1         0      1

4                  0      0                0

5          1       0      1         1      1

6                         0         0      0
LOOP TESTING
   Simple Loops:- 'n' is the maximum number of allowable
    passes
        skip the loop entirely.
        only one pass thru the loop.

        two passes thru the loop.

        m passes thru the loop where m< n.

        n-1,n,n+1 passes thru the loop



   Nested loops
        start with the innermost loop. Set all other loop to min. values.
        conduct simple loop tests for the innermost loop while holding the
         outer loops at their min. iteration values.
        work outward, conducting tests for the next loop, but keeping all
         the outer loops at their min. iteration count.
        continue until all loops have been tested.
EXERCISE
   1) Identify what scenarios have to be run to achieve
    100% statement coverage and 100% branch coverage
    on the following code


   2) Test the same examples on the following link.
       Does white-box covers 100% the black-box?

More Related Content

What's hot (20)

Testing ppt
Testing pptTesting ppt
Testing ppt
 
Software testing
Software testingSoftware testing
Software testing
 
Black & White Box testing
Black & White Box testingBlack & White Box testing
Black & White Box testing
 
Manual testing concepts course 1
Manual testing concepts course 1Manual testing concepts course 1
Manual testing concepts course 1
 
Alpha & Beta Testing
Alpha & Beta TestingAlpha & Beta Testing
Alpha & Beta Testing
 
Software Testing - Part 1 (Techniques, Types, Levels, Methods, STLC, Bug Life...
Software Testing - Part 1 (Techniques, Types, Levels, Methods, STLC, Bug Life...Software Testing - Part 1 (Techniques, Types, Levels, Methods, STLC, Bug Life...
Software Testing - Part 1 (Techniques, Types, Levels, Methods, STLC, Bug Life...
 
Regression testing
Regression testingRegression testing
Regression testing
 
Test Case Design and Technique
Test Case Design and TechniqueTest Case Design and Technique
Test Case Design and Technique
 
Introduction to software testing
Introduction to software testingIntroduction to software testing
Introduction to software testing
 
Software testing
Software testing Software testing
Software testing
 
Black box and white box testing
Black box and white box testingBlack box and white box testing
Black box and white box testing
 
White box ppt
White box pptWhite box ppt
White box ppt
 
Software Testing 101
Software Testing 101Software Testing 101
Software Testing 101
 
Software testing
Software testingSoftware testing
Software testing
 
White Box Testing
White Box TestingWhite Box Testing
White Box Testing
 
Principles of Software testing
Principles of Software testingPrinciples of Software testing
Principles of Software testing
 
Alpha and beta testing
Alpha and beta testingAlpha and beta testing
Alpha and beta testing
 
Black Box Testing
Black Box TestingBlack Box Testing
Black Box Testing
 
Regression testing
Regression testingRegression testing
Regression testing
 
Software Testing Tutorials - MindScripts Technologies, Pune
Software Testing Tutorials - MindScripts Technologies, PuneSoftware Testing Tutorials - MindScripts Technologies, Pune
Software Testing Tutorials - MindScripts Technologies, Pune
 

Similar to Whitebox testing

White Box Testing And Control Flow & Loop Testing
White Box Testing And Control Flow & Loop TestingWhite Box Testing And Control Flow & Loop Testing
White Box Testing And Control Flow & Loop TestingAnkit Mulani
 
ScioTalks | Coverage Based Testing
ScioTalks | Coverage Based TestingScioTalks | Coverage Based Testing
ScioTalks | Coverage Based TestingScio Consulting
 
1414_lecturueueueueuueueeueueueuusuee_7.ppt
1414_lecturueueueueuueueeueueueuusuee_7.ppt1414_lecturueueueueuueueeueueueuusuee_7.ppt
1414_lecturueueueueuueueeueueueuusuee_7.pptabdulbasetalselwi
 
Black Box Test Design Techniques
Black Box Test Design TechniquesBlack Box Test Design Techniques
Black Box Test Design TechniquesGlobalLogic Ukraine
 
Test design techniques: Structured and Experienced-based techniques
Test design techniques: Structured and Experienced-based techniquesTest design techniques: Structured and Experienced-based techniques
Test design techniques: Structured and Experienced-based techniquesKhuong Nguyen
 
CS8494 SOFTWARE ENGINEERING Unit-4
CS8494 SOFTWARE ENGINEERING Unit-4CS8494 SOFTWARE ENGINEERING Unit-4
CS8494 SOFTWARE ENGINEERING Unit-4SIMONTHOMAS S
 
20050314 specification based regression test selection with risk analysis
20050314 specification based regression test selection with risk analysis20050314 specification based regression test selection with risk analysis
20050314 specification based regression test selection with risk analysisWill Shen
 
Black Box Testing.pdf
Black Box Testing.pdfBlack Box Testing.pdf
Black Box Testing.pdfSupunLakshan4
 
White-box testing.pptx
White-box testing.pptxWhite-box testing.pptx
White-box testing.pptxhalaalz3by
 
Software Testing Tecniques
Software Testing TecniquesSoftware Testing Tecniques
Software Testing Tecniquesersanbilik
 
Unit testingandcontinousintegrationfreenest1dot4
Unit testingandcontinousintegrationfreenest1dot4Unit testingandcontinousintegrationfreenest1dot4
Unit testingandcontinousintegrationfreenest1dot4JAMK
 

Similar to Whitebox testing (20)

Whitebox
WhiteboxWhitebox
Whitebox
 
White box testing
White box testingWhite box testing
White box testing
 
White Box Testing And Control Flow & Loop Testing
White Box Testing And Control Flow & Loop TestingWhite Box Testing And Control Flow & Loop Testing
White Box Testing And Control Flow & Loop Testing
 
ScioTalks | Coverage Based Testing
ScioTalks | Coverage Based TestingScioTalks | Coverage Based Testing
ScioTalks | Coverage Based Testing
 
system verilog
system verilogsystem verilog
system verilog
 
white box testing.ppt
white box testing.pptwhite box testing.ppt
white box testing.ppt
 
Testing
TestingTesting
Testing
 
11 whiteboxtesting
11 whiteboxtesting11 whiteboxtesting
11 whiteboxtesting
 
1414_lecturueueueueuueueeueueueuusuee_7.ppt
1414_lecturueueueueuueueeueueueuusuee_7.ppt1414_lecturueueueueuueueeueueueuusuee_7.ppt
1414_lecturueueueueuueueeueueueuusuee_7.ppt
 
Black Box Test Design Techniques
Black Box Test Design TechniquesBlack Box Test Design Techniques
Black Box Test Design Techniques
 
Lesson 2....PPT 1
Lesson 2....PPT 1Lesson 2....PPT 1
Lesson 2....PPT 1
 
Test design techniques: Structured and Experienced-based techniques
Test design techniques: Structured and Experienced-based techniquesTest design techniques: Structured and Experienced-based techniques
Test design techniques: Structured and Experienced-based techniques
 
Testing part 2 bb
Testing part 2 bbTesting part 2 bb
Testing part 2 bb
 
CS8494 SOFTWARE ENGINEERING Unit-4
CS8494 SOFTWARE ENGINEERING Unit-4CS8494 SOFTWARE ENGINEERING Unit-4
CS8494 SOFTWARE ENGINEERING Unit-4
 
20050314 specification based regression test selection with risk analysis
20050314 specification based regression test selection with risk analysis20050314 specification based regression test selection with risk analysis
20050314 specification based regression test selection with risk analysis
 
Black Box Testing.pdf
Black Box Testing.pdfBlack Box Testing.pdf
Black Box Testing.pdf
 
White-box testing.pptx
White-box testing.pptxWhite-box testing.pptx
White-box testing.pptx
 
Software Testing Tecniques
Software Testing TecniquesSoftware Testing Tecniques
Software Testing Tecniques
 
SWE-6 TESTING.pptx
SWE-6 TESTING.pptxSWE-6 TESTING.pptx
SWE-6 TESTING.pptx
 
Unit testingandcontinousintegrationfreenest1dot4
Unit testingandcontinousintegrationfreenest1dot4Unit testingandcontinousintegrationfreenest1dot4
Unit testingandcontinousintegrationfreenest1dot4
 

More from Oana Feidi

More from Oana Feidi (18)

Test management
Test managementTest management
Test management
 
Spice
SpiceSpice
Spice
 
Root cause analysis
Root cause analysisRoot cause analysis
Root cause analysis
 
Testcase definition
Testcase definitionTestcase definition
Testcase definition
 
Test techniques
Test techniquesTest techniques
Test techniques
 
Reviews checklists
Reviews checklistsReviews checklists
Reviews checklists
 
Spice
SpiceSpice
Spice
 
Test management
Test managementTest management
Test management
 
Blackbox
BlackboxBlackbox
Blackbox
 
Testcase definition
Testcase definitionTestcase definition
Testcase definition
 
Reviews checklists
Reviews checklistsReviews checklists
Reviews checklists
 
Problematriunghiului
ProblematriunghiuluiProblematriunghiului
Problematriunghiului
 
Spice
SpiceSpice
Spice
 
Test Management introduction
Test Management introductionTest Management introduction
Test Management introduction
 
Testcase
TestcaseTestcase
Testcase
 
Testcase
TestcaseTestcase
Testcase
 
Blackbox
BlackboxBlackbox
Blackbox
 
Reviews Checklists
Reviews ChecklistsReviews Checklists
Reviews Checklists
 

Recently uploaded

THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 

Recently uploaded (20)

THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 

Whitebox testing

  • 1. SOFTWARE QUALITY ASSURANCE WHITE BOX Seminar: Oana FEIDI Quality Manager – Continental Automotive
  • 2. BLACK-BOX VS. WHITE-BOX  Test cases derived from specifications  The focus is not the design, nor the implementation  The focus is on the logic of implementation
  • 3. WHITE BOX (STRUCTURAL TESTING)  Structural - test case selection is based on an analysis of the internal structure of component  Control flow  Statement testing  Branch/Decision Testing  Branch Condition Testing  Modified Condition Combination Testing  Data flow testing
  • 4. WHITE BOX  Using the white-box testing techniques outlined in this seminar, a software engineer can design test cases that  exercise independent paths within a module or unit;  exercise logical decisions on both their true and false side;  execute loops at their boundaries and within their operational bounds  exercise internal data structures to ensure their validity
  • 5. STATEMENT TESTING  uses a model of the program’s control flow  it is designed in order to execute all or selected statements of the test object Test cases are design to execute each statement. An entity in a programming For each test case specify: language which is typically the smallest indivisible unit of • the input(s) of the component execution. • identification of statement(s) to be executed by the test case • the expected outcome of the test case Test completeness criteria: the percentage of the statements in the software which were executed at least at once (executing a statement means that the statement was encountered and evaluated during testing).
  • 6. EXAMPLE float foo (int a, int b, int c, int d, float e) { float e; if (a == 0) { return 0; } int x = 0; if ((a==b) OR ((c == d) AND bug(a) )) { x=1; } e = 1/x; statement return e; }
  • 7. BRANCH/DECISION TESTING  uses a model of the program’s flow  it is designed in order to execute (each) outcome of all or selected decision points in a test object an executable statement For each test specify: which may transfer control • the input(s) of the component to another statement, depending upon the logic • Identification of decision of the decision statement outcome(s) to be executed by the test case • the expected outcome of the test case Test completeness criteria: achievement of the test coverage – 100% of the branches (one true and one false for each part of condition)
  • 8. EXAMPLE A = true and (B or C) = false  A = false and (B or C) = true if A and (B or C) Case A B C Output 1 0 1 1 0 2 1 0 0 0
  • 9. BRANCH CONDITION COMBINATION  uses a model of the program flow where each combination of the inputs for a decision/condition must be tested, in order to check if each branch is covered  For each test case specify:  the input(s) of the component  the expected outcome of the test case which can show which branch is covered Test completeness criteria: for a condition containing n boolean operands → 2n test cases are required to achieve 100% coverage Note: this coverage rapidly becomes unachievable for more complex conditions.
  • 10. WHITE BOX - SUMMARY  Statement testing  uses a model of the program’s control flow  it is designed in order to execute all or selected statements of the test object  Branch/Decision Testing  uses a model of the program’s flow  it is designed in order to execute (each) outcome of all or selected decision points in a test object  Branch Condition Combination  uses a model of the program flow where each combination of the inputs for a decision/condition must be tested, in order to check if each branch is covered
  • 11. MODIFIED CONDITION COMBINATION TESTING  usesa model of the program’s flow where each atomic condition is independently tested, in order to show how the decision outcome is affected  test case are designed to show that each condition independently affects the decision outcome  For each test case specify:  the input(s) of the component  The expected outcome of the test case
  • 12. MODIFIED CONDITION COMBINATION TESTING  Test completeness criteria  for a condition containing n boolean operands, to achieve 100% coverage are necessary:  minimum: n + 1 test cases  maximum: 2n test cases  Example: for 3 boolean operands, to achieve 100% coverage are necessary:  Minimum 4 test cases  Maximum 6 test cases
  • 13. EXAMPLE Case A B B or C C Outcome 1 1 1 1 0 1 if (A and (B or C)) 2 0 0 3 1 1 1 0 1 4 0 0 0 5 1 0 1 1 1 6 0 0 0
  • 14. LOOP TESTING  Simple Loops:- 'n' is the maximum number of allowable passes  skip the loop entirely.  only one pass thru the loop.  two passes thru the loop.  m passes thru the loop where m< n.  n-1,n,n+1 passes thru the loop  Nested loops  start with the innermost loop. Set all other loop to min. values.  conduct simple loop tests for the innermost loop while holding the outer loops at their min. iteration values.  work outward, conducting tests for the next loop, but keeping all the outer loops at their min. iteration count.  continue until all loops have been tested.
  • 15. EXERCISE  1) Identify what scenarios have to be run to achieve 100% statement coverage and 100% branch coverage on the following code  2) Test the same examples on the following link. Does white-box covers 100% the black-box?