[erlang-questions] Timeout control in EUnit

Richard Carlsson <>
Thu Jun 4 18:12:17 CEST 2009

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

The thing to keep in mind is that each {timeout, Seconds, Tests} sets a
maximum total time for finishing all of Tests.


> -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:


and then set up your build environment so that the eunit directory
is found automatically during compilation.


More information about the erlang-questions mailing list