[erlang-questions] How to start application before all eunit cases
Mon Nov 24 16:08:44 CET 2014
I don't have an explanation for the application sometimes failing to find
the config file, but I can say that when I tried to use EUnit for anything
slightly more complicated than the simplest of tests, it turned into a
frustrating experience. Instead, I changed my tests to Common Test, which
may be a bit like killing a fly with a baseball bat, but it sure does the
job. And you can ramp up slowly with CT; I'm just using the _data directory
to hold data files and the init_per_suite/end_per_suite hooks to set up and
tear down. The best part is I didn't have to change the tests themselves,
other than to receive a Config argument.
Short answer: use Common Test.
On Sun, Nov 23, 2014 at 11:06 PM, linbo liao <> wrote:
> My Erlang project managed by rebar, it divides to different module.
> |-- rel
> |-- src
> |--- module1
> |--- module2
> |-- test
> |--- module1_tests.erl
> |--- module2_tests.erl
> and for each module*_tests.erl, Use Eunit Fixtures
> <http://www.erlang.org/doc/apps/eunit/chapter.html#Fixtures> to setup
> environment. For example,
> module1_test_() ->
> fun setup/0,
> fun clean_up/1,
> fun (SetupData) ->
> setup() ->
> clean_up(_) ->
> And Makefile is:
> ERL_AFLAGS="-config rel/pro/etc/app.config" $(REBAR) compile eunit skip_deps=true
> Here I encounter a problem, since I have many test module in test/, each
> test module will start and stop application for whole executing flow.
> Sometimes start application will be failed, told not find app.config
> configure file, not sure why.
> So I think is there a way to start application before all test module?
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions