[erlang-questions] Timeout control in EUnit

Koushik Narayanan koushik.list@REDACTED
Fri Jun 5 03:39:53 CEST 2009


Hi,

On Thu, Jun 04, 2009 at 06:12:17PM +0200, Richard Carlsson wrote:
> Koushik Narayanan wrote:
> > How do we specify timeout for tests in eunit, 
> > when the test module has more than one generator?
> 
> The timeout handling is currently a bit unpolished (not quite
> flexible enough), but what you can do is this:
> 
>  slow_test_() ->
>          {timeout, 60,
>           fun() ->
>                  timer:sleep(10000)
>           end}.
> 
> The thing to keep in mind is that each {timeout, Seconds, Tests} sets a
> maximum total time for finishing all of Tests.

Thanks. This solves my purpose.


> Also:
> 
> > -include_lib("/usr/lib/erlang/lib/eunit-2.1/include/eunit.hrl").
> 
> Note that the whole purpose of include_lib(...) is so that you do
> *not* have to write the whole path including version numbers. For
> portable code, you should write:
> 
>  -include_lib("eunit/include/eunit.hrl").
> 
> and then set up your build environment so that the eunit directory
> is found automatically during compilation.

Yes I get it. I did this to quickly get a test module to see what is 
happening.

Koushik Narayanan


More information about the erlang-questions mailing list