[erlang-questions] Design strategies for a test suite
John Haugeland
stonecypher@REDACTED
Fri May 16 23:08:23 CEST 2008
>
> If you use eunit, you can:
> - Write internal test functions that are automatically exported
> (you don't have to write -export() declarations for them), but
> which disappear when you compile with testing disabled.
>
Do you happen to know how this is implemented? I confess this actually
sounds a whole lot like the macro compile solution suggested earlier, but
I'm curious whether someone else has found a different way.
> - Put external test functions for x.erl in a module x_tests.erl
> and they will be run automatically when module x is tested.
>
Yeah, I've already got that running in mine. :)
> - Do a lot of neat stuff rather easily.
>
I'd appreciate someone else's perspective on what exactly constitutes "neat"
from the perspective of a testing suite. The reason I'm implementing my own
is to get some functionality that I haven't found in any other erlang test
suites (with the exception of a commercial suite, but Mine Shall Be Free
(tm)).
> If you prefer not to use eunit, you can still use similar conventions,
> and use conditional compilation to decide whether internal test
> functions should be compiled and exported or be excluded completely,
> while the tests for the external interface are kept in another module.
> I think that's the best you can hope for.
>
Maybe so. Admittedly, I'm now getting really really into the idea of
selective export, as it provides me a much better way.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080516/ae2890a7/attachment.htm>
More information about the erlang-questions
mailing list