Assignment 2

[Model answers]

1. Derive a set of black-box test cases for EACH of the following components:

(a) A function that takes a line of text as input and counts the number of non-blank characters in the line. [25 pts]

Cases should include following equivalence partitions [5 for each]

Deduct up to five for:

(b) A function that examines a line of text and replaces sequences of spaces with a single space. [25 pts]

Cases should include following equivalence partitions [4 for each]

Deduct up to five for:

Each test case in your answer should consist of an input, the expected output for that input, and a phrase describing the equivalence class or boundary value that the test case represents. You may assume that the functions are written in a strongly-typed language and that their inputs are guaranteed to be strings of characters. For invalid input strings, make assumptions about what the function should do in those cases and base your test cases on those assumptions.

2. Suppose that the functions above are among a larger number of editing functions provided by a TextLine abstract data type. Two testers, A and B, working independently design and apply their test cases to the TextLine ADT. Tester A finds 10 faults in the ADT, and tester B finds 12. Seven of the identified faults are common to Tester A and B.

(a) What is your best estimate of the number of faults remaining in the ADT? [20 pts]

a = 10, b = 12, q = 7

Ea = a/n = q/b = 7/12 Eb = b/n = q/a = 7/10

n = q/(Ea*Eb) = (a*b)/q = 120/7 = approx 17

(b) Would you be satisfied to release the code in its current state? Justify your answer. If you would not release the code yet, when would you? [10 pts]

EITHER No.

Because:

OR Maybe.

(c) Under what circumstances do you think it would be good professional practice to use these metrics to assess the quality of programmers and testers? [10 pts]

Evidence of thinking about problem. FOR EXAMPLE:

IGNORE argument that quality of program improves. That would be true without assessment of staff.

(d) Explain in no more than one paragraph what you would do if your project manager insisted that the ADT be included in the current software release once the known defects had been corrected. (You may assume that correcting the known defects did not result in any new ones.) [10 pts]

REASONING

ACCEPTABLE CONCLUSIONS [5 pts]

UNACCEPTABLE ANSWERS/CONCLUSIONS [0 pts]