标签: common-test

如何让Rebar在发布目录中运行Common Test?

我有一个带有顶级版本目录的Rebar项目,该目录只包含组件应用程序作为依赖项,并包含reltool配置.

我的一些应用程序在test子目录中有Common Test suite ,我可以运行这些测试rebar ct.

现在我想为整个版本创建一个Common Test套件.但是,当我rebar ct skip_deps=true在顶级目录中运行时,我得到:

Command 'ct' not understood or not applicable
Run Code Online (Sandbox Code Playgroud)

如何让Rebar运行我的测试?

erlang rebar common-test

8
推荐指数
1
解决办法
2734
查看次数

使用通用测试的模块的Erlang测试(非导出/私有)功能

我在Erlang中有一个模块,其中的函数不是由Erlang导出的.如何使用通用测试框架测试/调用这些函数?

testing erlang erlang-otp rebar common-test

8
推荐指数
1
解决办法
1859
查看次数

是否可以以随机顺序运行Common Test运行测试用例?

我为我编写的Erlang应用程序提供了几十个Common Test测试套件模块.所有测试都通过了,但我觉得测试套件非常脆弱.重新排序测试会导致其中一些失败.我没有阅读Common Test文档中依赖项章节,我经常对单元测试中的应用程序状态做出假设.现在我想让我的测试套件更加强大.

随机化测试订单?

来自Ruby,Rspec以随机顺序运行测试,我希望在Common Test中具有相同的功能.有没有人知道是否有办法在Common Test中随机化测试顺序?我没有在文档中看到有关随机化测试顺序的任何内容.

随机化返回值all/0groups/0

我还想过改变all/0groups/0回调的输出.现在他们只返回硬编码列表.也许我可以随机化元素的排序并让它们每次以不同的顺序运行?有没有人通过更改Common Test中的回调返回值来随机化测试顺序?我还需要一种方法来重新运行测试,导致它们像Rspec的--seed标志一样失败.

提前致谢!

random erlang unit-testing common-test

6
推荐指数
1
解决办法
157
查看次数

为什么 ets 表可以在 ct:init_per_testcase 中幸存下来,但在 init_per_suite 中不行?

我有一个通用的测试套件,它尝试创建一个 ets 表以用于所有套件和所有测试用例。它看起来像这样:

-module(an_example_SUITE).
-include_lib("common_test/include/ct.hrl").

-compile(export_all).

all() -> [ets_tests].

init_per_suite(Config) ->
    TabId = ets:new(conns, [set]),
    ets:insert(TabId, {foo, 2131}),
    [{table,TabId} | Config].

end_per_suite(Config) ->
    ets:delete(?config(table, Config)).

ets_tests(Config) ->
    TabId = ?config(table, Config),
    [{foo, 2131}] = ets:lookup(TabId, foo).
Run Code Online (Sandbox Code Playgroud)

ets_tests函数因 badarg而失败。创建/销毁每个测试用例的 ets 表,如下所示:

-module(an_example_SUITE).
-include_lib("common_test/include/ct.hrl").

-compile(export_all).

all() -> [ets_tests].

init_per_testcase(Config) ->
    TabId = ets:new(conns, [set]),
    ets:insert(TabId, {foo, 2131}),
    [{table,TabId} | Config].

end_per_testcase(Config) ->
    ets:delete(?config(table, Config)).

ets_tests(Config) ->
    TabId = ?config(table, Config),
    [{foo, 2131}] = ets:lookup(TabId, foo).
Run Code Online (Sandbox Code Playgroud)

运行这个,我发现它运行得很好。

我对这种行为感到困惑,无法确定为什么会发生这种情况,形成docs …

testing erlang common-test

5
推荐指数
1
解决办法
583
查看次数

如何使用rebar为common_test运行测试指定配置文件

我有一个通用的测试套件,我需要用钢筋来执行它.通常用命令完成

rebar ct suites=mysuite
Run Code Online (Sandbox Code Playgroud)

但是有一个障碍.我的套件是必需的配置文件,我需要在执行测试时指定它.ct_run允许这样做

ct_run -config <configfile>
Run Code Online (Sandbox Code Playgroud)

有谁知道如何用钢筋指定配置文件?

erlang rebar common-test

4
推荐指数
1
解决办法
1523
查看次数

如何仅导出所有常用测试功能?

我一直在尝试导出erlang模块中的所有函数,以便在通用测试SUITE中使用,而不是在eunit模块中使用.到目前为止,它对我没用.我使用的螺纹钢运行SUITE,和我遇到了这个问题(就http://lists.basho.com/pipermail/rebar_lists.basho.com/2011-October/001141.html),这基本上是我想要什么要做,但该方法不适合我.

我还添加{plugins, [rebar_ct]}.到rebar.config但它没有任何区别.当我正常导出函数时,我应该指出所有测试都通过,但我想避免这种情况.任何帮助都会非常感谢.

erlang rebar common-test

2
推荐指数
2
解决办法
3590
查看次数

标签 统计

common-test ×6

erlang ×6

rebar ×4

testing ×2

erlang-otp ×1

random ×1

unit-testing ×1