[erlang-questions] erlang-questions Digest, Vol 12, Issue 70

John Haugeland stonecypher@REDACTED
Thu May 22 18:00:32 CEST 2008


> Others have answered about /how/ you may test unexported
> functions, so I thought I'd chip in to ask you /why/ you
> would want to?
>

To see if they're working.  Just because something's internal doesn't mean
it doesn't need to be verified.  I mean I understand and respect the
perspective that what's exported is the determinant and the important part
of a module; at the same time, testing is about making sure I got my stuff
right, and errors and defects are just as likely in private code as they are
in public.

Practically speaking, many tests aren't viable if they have to be dispatched
upstream.  In particular, testing something to make sure it behaves
correctly with malformed data is nearly impossible if you're only feeding it
data from your normal upstream code.

Yes, there's something to be said for tests that only mimic real world
circumstances, but there's also something to be said for exhaustive testing,
and something which is limited to the currently realistic set of
circumstances and causations is anything but exhaustive.  Code sensibly.
Test paranoiacally.

Anyway, it's an opinion.



    - John



------
GuaranteedVPS.com - bandwidth commitments and root starting from $12.98/mo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080522/7b256937/attachment.htm>


More information about the erlang-questions mailing list