whiteBoxTesting - White-box Structural Testing White Box...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Fall 2005 CS514 WB-1 White-box, Structural Testing Supplement to Notes 6 J. Bieman CS514 Fall 2005 CS514 WB-2 White Box Test Coverage Criteria. Statement or node coverage. Branch coverage, edge coverage, or decision coverage. Condition coverage. Definition/Use (dataflow) coverage. – All-uses – All-du-paths – … Fall 2005 CS514 WB-3 Test Coverage Strength Branch coverage is stronger than statement coverage, Condition coverage is stronger than branch coverage, and Definition/Use coverage is stronger than branch coverage. If tests satisfy a coverage criteria, they also satisfy all weaker ones. Fall 2005 CS514 WB-4 Example Look at the code: if (A) S1; S2; We can cover both S1 and S2 with 1 test. Just set A=true. To cover all branches, we must also test the path that skips S1. We need another test case where A=false. Fall 2005 CS514 WB-5 Sometimes Stronger Coverage is Needed Buggy code: i = 0; if (A) i = 1; x = y/i; No error when you test with A=true. Bombs if you test with A=false. Branch coverage reveals the error, but statement coverage does not! Fall 2005 CS514 WB-6 An Error, Not Detected by Branch Coverage ... if (A() && B()) x = y + z; ... boolean A() { if (F1) { q = 0; return true; } else return false; } ... boolean B() { if (F2) { q = 0; return true; } else { x = 10/q; return false; } }
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Fall 2005 CS514 WB-7 We Test the Code Branch coverage is satisfied with 2 tests: F1==true and F2==true: takes the true path. F1==false and F2==false: takes the false path. The error occurs when F1==true & F2==false. Condition coverage or DU pairs (all-uses) coverage would require this test. Fall 2005 CS514 WB-8 Definitions & Uses Definition: the point in a program where a variables value is set or changed. Use: the point where a variables value is used. DU-path: a program path from a variable definition to a use, without an intervening definition to the variable.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern