【发布时间】:2015-01-21 20:08:24
【问题描述】:
我的 Erlang 项目由 rebar 管理,它分为不同的模块。
-pro
|-- rel
|-- src
|-- test
|--- module1_tests.erl
|--- module2_tests.erl
对于每个模块*_tests.erl,使用 Eunit Fixtures 来设置环境。例如,
module1_test_() ->
{setup,
fun setup/0,
fun clean_up/1,
fun (SetupData) ->
[
test_function(SetupData)
]
end}.
setup() ->
pro:start(),
ok.
clean_up(_) ->
pro:stop().
Makefile 是:
test:
ERL_AFLAGS="-config rel/pro/etc/app.config" $(REBAR) compile eunit skip_deps=true
这里我遇到一个问题,因为我在 test/ 中有很多测试模块,每个测试模块都会启动和停止整个执行流程的应用程序。有时候启动应用会失败,提示找不到app.config配置文件,不知道是什么原因。
所以我认为有没有办法在所有测试模块之前启动应用程序?
【问题讨论】:
标签: erlang erlang-otp rebar eunit