[erlang-questions] How to structure EUnit tests [was: I Hate Unit Testing]

Richard Carlsson <>
Thu Jan 29 18:05:46 CET 2009


Dan Milstein wrote:
> I have some fears that whatever parse_transform magic is going  
> within eunit will cause troubles some day in production.

This is actually very little: the parse transform only handles the
automatic exporting of test functions (or stripping, when compiling
with testing disabled). All the rest is done through macros and/or
using run-time information. I felt it was important that the code
did not become too dependent on eunit itself: in a pinch, you should
be able to write your own dummy replacements for the eunit.hrl macros,
and be able to compile and run the code anyway. And object files that
have been created with eunit enabled are not dependent on having the
eunit libraries around, neither for normal execution nor for running
the test functions. (There are a couple of documented exceptions,
when using the macros for running OS commands.)

    /Richard




More information about the erlang-questions mailing list