[erlang-questions] eunit setup and cleanup

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


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

Here's a small example:

-module(eunit_simple).
-include_lib("eunit/include/eunit.hrl").

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

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

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

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

filippo

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