Hey Guys,
I wrote an additional suggestion earlier
on the generation of unit tests, but I can't respond
to it because it has not passed through moderation
yet.
Just wanted to add this additional note:
One thing that is useful to start with with is
"What does it mean for a method to be 100% unit
tested?"
For instance suppose there's a method
public int multiply(int a, int b)
return aXb;
Do we unit test this?
Probably not.
The assumption here is that unless this always works
conceptually, as long as we pass valid integer
parameters.
So to guarantee the method all that is needed is to
check the parameters to make sure they are valid for
the runtime context.
Although we could still have a unit test on it just in
case there was an issue with the VM running the code,
the hardware, etc. Then if there was a production
environment oddity occuring, we could run it, just to
make sure something is not wacked.
What about
public String append(String a, String b)
return a+b;
This is 100% tested too, assuming all valid java
strings are ok. If we need to narrow the set of
Strings that are allowed, then we use constraints on
the parameters again. Then we could test that what we
expect to happen given disallowed parameters happens,
and what we expect given permitted parameters happens.
This stuff is sort of obvious, but I figured I'd throw
it into the mix.
Happy New Year All,
- Ole
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com