1

如何在测试文件夹中运行 ejabberd 测试?我安装了 rebar 并确保有一个正在运行的 ejabberd 服务器,并按照此处的步骤: https ://docs.ejabberd.im/developer/extending-ejabberd/testing/ 运行测试套件。

但我收到以下错误:

[ec2-user@ip-173-33-33-236 ejabberd]$CT_BACKENDS=mnesia rebar ct suites=ejabberd groups=mnesia
WARN:  Missing plugins: [rebar3_hex]
==> ejabberd (ct)
ERROR: ct_run -noshell -pa "/home/ec2-user/ejabberd/ebin" 
"/home/ec2-user/ejabberd/deps/jose/ebin" "/home/ec2-user/ejabberd/deps/idna/ebin" 
"/home/ec2-user/ejabberd/deps/yconf/ebin" "/home/ec2-user/ejabberd/deps/jiffy/ebin" 
"/home/ec2-user/ejabberd/deps/p1_utils/ebin" "/home/ec2-user/ejabberd/deps/base64url/ebin" 
"/home/ec2-user/ejabberd/deps/fast_yaml/ebin" "/home/ec2-user/ejabberd/deps/stringprep/ebin" 
"/home/ec2-user/ejabberd/deps/ezlib/ebin" "/home/ec2-user/ejabberd/deps/fast_tls/ebin" 
"/home/ec2-user/ejabberd/deps/fast_xml/ebin" "/home/ec2-user/ejabberd/deps/unicode_util_compat/ebin" 
"/home/ec2-user/ejabberd/deps/proper/ebin" "/home/ec2-user/ejabberd/deps/base16/ebin" 
"/home/ec2-user/ejabberd/deps/lhttpc/ebin" 
"/home/ec2-user/ejabberd/deps/eini/ebin" "/home/ec2-user/ejabberd/deps/jsx/ebin" 
"/home/ec2-user/ejabberd/deps/meck/ebin" "/home/ec2-user/ejabberd/deps/goldrush/ebin" 
"/home/ec2-user/ejabberd/deps/p1_mysql/ebin" "/home/ec2-user/ejabberd/deps/p1_acme/ebin" 
"/home/ec2-user/ejabberd/deps/mqtree/ebin" "/home/ec2-user/ejabberd/deps/eimp/ebin" 
"/home/ec2-user/ejabberd/deps/pkix/ebin" "/home/ec2-user/ejabberd/deps/p1_oauth2/ebin" 
"/home/ec2-user/ejabberd/deps/xmpp/ebin" "/home/ec2-user/ejabberd/deps/cache_tab/ebin"
 "/home/ec2-user/ejabberd/deps/uuid/ebin" "/home/ec2-user/ejabberd/deps/erlcloud/ebin" 
"/home/ec2-user/ejabberd/deps/lager/ebin" "/usr/local/bin/rebar/rebar/ebin" 
"/usr/local/bin/rebar" "/home/ec2-user/ejabberd/."  -include "/home/ec2-user/ejabberd/include"  
-name test2876@ip-172-31-32-236.us-east-2.compute.internal -logdir 
"/home/ec2-user/ejabberd/logs" -env TEST_DIR "/home/ec2-user/ejabberd/test" 
-cover /home/ec2-user/ejabberd/cover.spec  -suite test/ejabberd_SUITE.erl 
-group mnesia -ct_hooks cth_surefire  -include /home/ec2-user/ejabberd/tools 
-include /home/ec2-user/ejabberd/include -include /home/ec2-user/ejabberd/deps/p1_utils/include 
-include /home/ec2-user/ejabberd/deps/fast_xml/include 
-include /home/ec2-user/ejabberd/deps/xmpp/include  >>
 /home/ec2-user/ejabberd/logs/raw.log 2>&1 failed with error: 1 and output:

ERROR: ct failed while processing /home/ec2-user/ejabberd: rebar_abort

如何运行这些单元测试?另外,是否有推荐的框架来编写 ejabberd/erlang 单元测试?我基本上想在模块中为各种输入运行一些特定功能,并确保输出正确,我是否需要为此运行服务器部分?

任何建议/指针将不胜感激。谢谢!

4

1 回答 1

0

您没有提到 ejabberd 和 erlang 版本,所以我认为它们是最新的可用版本。

如何运行这些单元测试?

请注意,ejabberd 已经包含了 rebar 程序。所以最好使用那个而不是你安装的任何东西。我只是运行它,并且可以正常工作:

CT_BACKENDS=mnesia ./rebar ct suites=ejabberd groups=mnesia

我确实需要为此运行服务器部分吗?

运行该命令时无需启动 ejabberd。至少我在运行测试之前停止它......

另外,是否有推荐的框架来编写 ejabberd/erlang 单元测试?我基本上想在模块中为各种输入运行一些特定的功能,并确保输出正确并且

对不起,不知道。

于 2020-02-17T12:06:05.767 回答