[erlang-questions] rebar and eunit test prep

Bob Ippolito <>
Wed Jun 22 21:21:15 CEST 2011


On Wed, Jun 22, 2011 at 12:14 PM, Joel Reymont <> wrote:
> Suppose my eunit tests require mnesia to be started and a schema to be installed.
>
> How do I incorporate that into ./rebar eunit such that the setup above is done only once?
>
> I definitely don't want to start mnesia and install the schema before every test.

Take a look at the {setup, ...} fixture [1] and put all of the
Mnesia-requiring tests in there. Alternatively you can use meck or
another mocking module to stub out Mnesia calls if that makes sense
for some of the tests.

[1] http://www.erlang.org/doc/apps/eunit/chapter.html#Fixtures

-bob



More information about the erlang-questions mailing list