Presentation is loading. Please wait.

Presentation is loading. Please wait.

Whitebox Testing Fra: CS2335 - Fall 2002. Whitebox Testing AKA Structural, Basis Path Test Normally used at unit level Assumes errors at unit level are.

Similar presentations


Presentation on theme: "Whitebox Testing Fra: CS2335 - Fall 2002. Whitebox Testing AKA Structural, Basis Path Test Normally used at unit level Assumes errors at unit level are."— Presentation transcript:

1 Whitebox Testing Fra: CS2335 - Fall 2002

2 Whitebox Testing AKA Structural, Basis Path Test Normally used at unit level Assumes errors at unit level are in the control structure or data path Generates test cases to test control paths through the code Criteria includes Control-Flow and Data-Flow based coverage

3 Coverage Criteria Control Flow based: Statement Coverage (All nodes) Branch (or Decision) Coverage (All edges) All Paths Data Flow based: All DU paths All C uses All Defs Etc…

4 Unit Module Specification Invoices are calculated using the following algorithm: Item X sells for $5 and Item Y sells for $10 Invoice Total >=$200 get 5% discount Invoice Total >=$1000 get 10% discount Invoices that order more than 30 X items get a 5% discount

5 Example Program int invoice (int x, int y) { int d1, d2, s; if (x<=30) d2=100; else d2=90; s=5*x + 10 *y; if (s<=200) d1=100; else if (s<=1000) d1 = 95; else d1 = 80; return (s*d1*d2/10000); } if d2=100d2=90 if d1=100 if d1=95 d1=80 return x>30 s>200 s>1000

6 Statement Coverage if d2=100d2=90 if d1=100 if d1=95 d1=80 return x>30 s>200 s>1000 Test CaseExpected Output X=5 Y=575 X=31 Y=10229.5 X=30 Y=100977.5

7 Branch Coverage Test CaseExpected Output X=5 Y=575 X=31 Y=10229.5 X=30 Y=100977.5 if d2=100d2=90 if d1=100 if d1=95 d1=80 return x>30 s>200 s>1000

8 Path Coverage if d2=100d2=90 if d1=100 if d1=95 d1=80 return x>30 s>200 s>1000 With loops impossible 6 Test Cases


Download ppt "Whitebox Testing Fra: CS2335 - Fall 2002. Whitebox Testing AKA Structural, Basis Path Test Normally used at unit level Assumes errors at unit level are."

Similar presentations


Ads by Google