[英]Prevent eunit from timing out when running Triq tests
如何在rebar3配置中更改eunit的超時?
當我運行基於屬性的Triq測試時,我的eunit runner正在超時:
===> Verifying dependencies...
===> Compiling ierminer
===> Performing EUnit tests...
Pending:
test_ec:ec_prop_test/0
%% Unknown error: timeout
undefined
%% Unknown error: {blame,[3,1]}
Finished in ? seconds
3 tests, 0 failures, 3 cancelled
===> Error running tests
這是我的屬性規范:
-module(ec_property).
-include_lib("triq/include/triq.hrl").
prop_append() ->
?FORALL({Xs,Ys},{list(int()),list(int())},
lists:reverse(Xs++Ys)
==
lists:reverse(Ys) ++ lists:reverse(Xs)).
prop_valid_started() ->
?FORALL({Type, Items, Size},
{oneof([left,right]), non_empty(list(any())), pos_integer()},
element(1, ec:start(Type, Items, Size)) == ok).
以下是我從我的eunit測試函數中調用它的方法:
ec_prop_test() -> ?assert(ec_property:check()).
使用測試生成器函數指定超過默認值5秒的超時:
ec_prop_test_() ->
{timeout, 30, ?_assert(ec_property:check())}.
請注意添加到函數名稱的尾部下划線 - 這是您創建測試生成器的方式。 還要注意_assert
上的前導下划線,這是創建測試對象的一種方法。
將示例中的30
更改為您需要的秒數。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.