[erlang-questions] eunit setup and cleanup

Filippo Pacini pacini@REDACTED
Fri Sep 7 12:19:42 CEST 2007

I've read it, but I don't understand how to specify the test.

Here's a small example:


setup() ->
    io:format("Setup called", []).

do_test_() ->
   {setup, fun setup_test/0, [?_assert(1=:=0)]}.

And running it:
1> eunit_simple:test().
  Test successful.

It seems setup is not called, nor the assertion.
I've tryed several variants for writing do_test_ but nothing seems works.


Richard Carlsson wrote:
> Filippo Pacini wrote:
>> I'm trying to write some tests using eunit.
>> I have to do some setup before executing a group of tests (e.g start an
>> OTP application, or to prepare data in a mnesia table). Is it possible
>> with eunit? Are there examples somewhere I can look at?
>> I found in the doc a reference to fixtures, but couldn't figure out how
>> they works.
> Have you read though this?:
> http://svn.process-one.net/contribs/trunk/eunit/doc/overview-summary.html#Fixtures

More information about the erlang-questions mailing list