【发布时间】:2019-10-17 16:06:44
【问题描述】:
我有一个 REST 服务的 Erlang 应用程序。我有一个 relx 文件,当我启动时:
rebar3 release
我得到一个可执行文件
./_build/default/rel/myapp/bin/myapp
当我启动它时,服务就会启动,我可以在localhost:80 上点击我的服务。
现在我正在尝试编写一个测试套件来测试一些 API 调用。在我的常见测试init_per_suite(Config) 函数中,我想启动我的应用程序,例如:
-module(apitest_SUITE).
-include_lib("common_test/include/ct.hrl").
-export([all/0]).
-export([test1/1, init_per_suite/1, end_per_suite/1]).
all() -> [test1].
init_per_suite(Config) ->
%LAUNCH MY APP HERE!!!
%LAUNCHING ../../_build/default/rel/myapp/bin/myapp SEEMS WRONG TO ME
[].
end_per_suite(Config) ->
%KILL MY APP HERE!!!
ok.
test1(Config) ->
httpc:get("localhost:80"). %e.g.
从这个 common_test 套件启动我的版本并进行测试的正确方法是什么?
顺便说一句,我正在使用
启动我的测试rebar3 ct
【问题讨论】:
标签: erlang