2016-04-05 75 views
0

如何更改rebar3配置中eunit的超時時間?運行Triq測試時防止超時超時

我eunit亞軍已超時,當我經營的酒店爲基礎的Triq測試:

===> 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()). 

回答

2

使用test generator function指定的超時時間超過默認的5秒:

ec_prop_test_() -> 
    {timeout, 30, ?_assert(ec_property:check())}. 

注意末尾添加下劃線在函數名—這就是你如何創建一個測試發電機。還請注意_assert上的前導下劃線,這是創建測試對象的一種方法。

將示例中的30更改爲所需的秒數。