Re: A simple unit test framework
On May 5, 3:08 pm, "Bo Persson" <b...@gmb.dk> wrote:
Ok, then. If you were to develop a log() function, how many
test cases would you need for a black box testing?
In this case, it's not really just a question of black box
versus white box. To effectively test log(), you need something
around 1,8 E19 tests. At one test per microsecond (and I doubt
that you can do them that fast), that's over 6000 centuries.
If you want to be relatively sure of the correctness of your
function, and still deliver it on schedule, you will take two
steps:
-- you will have it reviewed by people who know numeric
processing, for possible errors, and
-- you will write tests based on knowledge of the algorithm
used, to verify the limit cases for that algorithm.
Pete's point is, I think, that you cannot do the latter until
you've decided what algorithm(s) to use. In the case of a
function like log(), you can't simply test 100% of the possible
input, and you don't know what is important to test until you've
actually written the code.
Note that the two steps above work together. The people doing
the code review also review the tests, and verify that your
choice of test cases was appropriate for the code you wrote.
--
James Kanze (Gabi Software) email: james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34