[erlang-questions] Design strategies for a test suite

Richard Carlsson <>
Fri May 16 22:58:40 CEST 2008

John Haugeland wrote:
> Someone have a better idea?  I mean, if there was a way for me to just 
> be horrible and ignore the export inbound call limits, I'd do it in a 
> heartbeat, but I don't think that actually exists.
> Should I just gracefully accept export([]) as a limitation?  Should I 
> require the use of a macro-granted magical gateway?  Is there another 
> option?

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.
  - Put external test functions for x.erl in a module x_tests.erl
    and they will be run automatically when module x is tested.
  - Do a lot of neat stuff rather easily.

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.


  "Having users is like optimization: the wise course is to delay it."
    -- Paul Graham

More information about the erlang-questions mailing list