Black Box & White Box Testing

BLACK BOX TESTING:1. CAUSE EFFECT GRAPH:
Consider the payroll system of a person: (a) If the salary of a person is less than equal to Rs. 70,000 and expenses do not exceed Rs. 30,000 then 10% tax is charged by IT department. (b) If the salary is greater than Rs.60,000 and less than equal to Rs 2lakhs and expenses don't exceed Rs. 40,000 than 20% tax is charged by IT department. (c) For salary greater than Rs 2 lacks, 5% additional surcharge is also charged. (d) If expenses are greater than Rs. 40,000 surcharge is 9%.

Causes

Effects

C1 : Salary < = 70,000 C2 : Salary > 60,000 and Salary < = 2 lacks C3 : Salary > 2 lacks C4 : Expenses < = 30,000 C5 : Expenses < = 40,000 C6 : Expenses > 40,000
1

E1: 10% tax is charged. E2: 20% tax is charged. E3: (20% tax) + (5% surcharge) is charged. E4: (20% tax) + (9% surcharge) is charged.

Black Box & White Box Testing C 1 AND E 1 C 2 AND C 3 E 2 C 4 AND E 3 C 5 AND C 6 E 4 2 .

Black Box & White Box Testing BOLLEAN FUNCTIONS: E1: C1 ^ C4 E2: C2 ^ C5 E3: C3 ^ c5 E4: C3^ C6 DECISION TABLE: C1 T F F F T T F C2 F T F F T F T C3 F F T T F F F C4 T F F F F T T C5 F T T F F T F C6 F F F T F F F E1 T F F F T T F E2 F T F F F F T E3 F F T F F F F E4 F F F T F F F 3 .

000 Expenses < = 40. 4 Salary > 2 lacks 4 .000 Expenses > 40. 20% tax is charged 2 3 (20% tax) + (5% surcharge) is charged (20% tax) + (9% surcharge) is charged.000 and Salary < = 2 lacks Salary > 2 lacks Expense Expenses < = 30.000 EXPECTED OUTPUTS (EFFECTS) 10% tax is charged.000 Expenses < = 40.000 Salary > 60. .Black Box & White Box Testing TEST CASES: TEST CASES 1 INPUTS (CAUSES) Salary Salary < = 70.

p< 10000 p is in between 10000 – 99999 > 99999 P is alphabet P is floating point number P is null Partitions for outputs: Is five digit number Is not five digit number Error message Test Cases 5 1 2 3 4 5 . EQUIVALENCE PARTITIONING: Lets we have to test a five digit number.Black Box & White Box Testing 2. Partitions for inputs : Let the inputs is denoted by ‘p’.

7 Error message Abc Error message Test Case P Expect ed output 6 4353 34 Is not five digit numb er 7 1000 0 Is five digit numb er 8 -34.32 Error messa ge 9 9999 9 Is five digit numb er 10 Gfs123 Error message 11 $@#% Error message 12 null Error message 6 .Black Box & White Box Testing P Expected output 123 Is not five digit number 24242 Is five digit number -23 Is not five digit numb er 34.

ti.Black Box & White Box Testing 2. 1 public static double ReturnAverage(int value[]. while (ti < AS && value[i] != -999) { ti++. else av = (double) -999. double av. ti = 0. sum = 0. sum. } 7 . tv = 0. tv. WHITE BOX TESTING: Branch and Path Coverage (av). if (value[i] >= MIN && value[i] <= MAX) { tv++. } if (tv > 0) av = (double)sum/tv. } i++. int MIN. int MAX){ 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 int i. int AS. i = 0. sum = sum + value[i]. return (av).

Black Box & White Box Testing 8 .

16 P-use 5.14 17 Du Pairs: 9 .Black Box & White Box Testing Varibles value[] AS MIN MAX i ti tv Sum av definitions 1 1 1 1 4 4 4 4 14.7 5 7 7 C-use 9 11 5 13 6 8 9.

8 c-use of tv 4.17 c-use of av 10 .11: c-use of i 4.14 c-use of sum 14.9 & 4.7: p-use of MAX 1.5: p-use of ti 4.5: p-use of AS 1.6: c-use of ti 4.7 : p-use of value[] 1.13: p-use of tv 4.9: c-use of value[] 1.17 &16.Black Box & White Box Testing 1.7: p-use of MIN 4.5 & 1.

3.2.7 1.2.5 SUBPATHS INPUT OUTPUTS (PUSHOUTP UTS) Value[] 1.13 1.4.3.4.5.5.5 Any value not equal to -999 Value greater than MIN and less than MAX Value greater than ti Integer value Integer value Value less than AS Greater than 0 Integer accepted Value accepted 2 Value[] 1.5.4.Black Box & White Box Testing TEST CASES (ALL P-USE): TEST CASE # 1 VARIABLE S DUPAIR S 1.6.7 4.5 4.2.8.5 1.4.13 Value accepted Value accepted tv accepted 11 .7.5 1.2.1 0.7 1.7 1.4.6.11.3.6.3.5.9.12.3.7 3 4 5 6 7 AS MAX MIN Ti tv 1.7 4.2.6.5 4.

9 1-9 Values at value[i] Takes the values at ith position of array Increments i Increments tv Adds to the sum Adds to the sum Returns the value Returns the value 2 3 4 5 6 i Tv Sum Sum Av 4.11 4.8 4.Black Box & White Box Testing TEST CASES( ALL C-USE) TEST CASE# VARIABLES DUPAIRS SUBPATH S INPUT OUTPUTS (PUSHOUTPUT S) 1 Value 1.14 14.17 4-11 4-8 4-9 4-14 14.17 Integer value Integer value Integer value Integer value Takes the Computed the value Takes the Computed the value 7 av 16. 17 16.17 12 .16.15.9 4.

Sign up to vote on this title
UsefulNot useful