Dashboard > Contributions > Contributions > EUnit
EUnit Log In View a printable version of the current page.

Added by Mickaël Rémond , last edited by Mickaël Rémond on Oct 05, 2007  (view change)
Labels: 

Erlang unit test framework

Eunit is an Erlang test suite tool, inspired by agile development ideas.

Development version

The development version can be accessed from Process-one subversion repository:

svn co http://svn.process-one.net/contribs/trunk/eunit eunit

Changes can be tracked on Process-one forge.

You can report bugs or feature request on Eunit Ticket Tracker

Anonymous

Please post a zip of EUnit - not everyone can get svn access.

Thanks,
Anon

Reply To This
Anonymous

Sorry, didn't see the Attachments tab

Maybe link to the attachment from the page.

 Anon

Reply To This
Anonymous


Updated by Mickaël Rémond
Jul 16, 2007 10:10

Hi

Version from svn doesn't work. When compiling :

-module(test).
-include_lib("eunit/include/eunit.hrl").
-export([add/2)]).

add(A, B) ->
A + B.

%%% Tests %%%
add_test() -> 2 = add(1, 1).

I get the following output :

./test.erl:none: error in parse transform 'eunit_autoexport': {undef,
[{eunit_autoexport,
parse_transform,
[[{attribute,
1,
file,
{"./test.erl",1}},

{attribute,1,module,test}
,
{attribute,
1,
file,
{"c:/PROGRA~1/ERL55~1.5/lib/e
unit/include/eunit.hrl",
1}},
{attribute,
3,
file,
{"./test.erl",3}},
{error,
{5,
erl_parse,
["syntax error before: ",
["')'"]]}},
{function,
8,
add,
2,
[{clause,
8,
[
{var,8,'A'}
,
{var,8,'B'}
],
[],
[{op,
9,
'+',
{var,9,'A'}
,
{var,9,'B'}}]}]},
{function,
13,
add_test,
0,
[{clause,
13,
[],
[],
[{match,
13,

{integer,13,2}
,
{call,
13,
{atom,13,add}
,
[
{integer,13,1},
{integer,13,1}
]}}]}]},
{eof,15}
],
[report_errors,
report_warnings]]},
{compile,                                                 
'-foldl_transform/2-anonymous-2\- ',                                                
2}
,
{compile,foldl_transform,2}
,
{compile,                                                 
'-internal_comp/4-anonymous-1-',                                                  
2}
,
{compile,fold_comp,3}
,
{compile,internal_comp,4}
,
{compile,internal,3}
]}
error

Is there a more recent stable version than 1.1 (rather old) ?

Reply To This

Hello,

The directive include_lib is to be used if you have installed eunit in the Erlang/OTP lib directory.

If you do not have installed it there, you have to use the directive include. You can put the full path to the hrl file in your include directive or use the -I option from the command line compiler erlc to give the path to your include files to the compiler.

I hope this helps, 

Reply To This
Anonymous

I had the same problem, at first.  Must be for those of us used to non-compiled scripting languages (I've been working in Ruby for a long time).

 cd into the eunit directory and run the make command, and it will build the appropriate *.beam files in the ./ebin directory.  Then you should be able to compile a program that includes eunit.hrl (if the library is in the right place, etc.).

For what it matters, I copied my eunit tree under /usr/local/lib/erlang/lib, and it then worked fine (after compilation with make).

Reply To This
Anonymous

Is there a plan to release more documentation on the watch facilities? This looks like a really interesting feature for Cruise Control style testing. I played around with it an could get watching a module to work using:

> eunit:watch(module).
> code:purge(module).
> code:load_file(module).

But I would much prefer to be able to watch a file and have EUnit run the tests when a file is saved. Does this work currently? I tried:

> eunit:watch_file("src/module.erl").

and

> eunit:watch_file("ebin/module.beam").

with no effect.

Reply To This
Anonymous

Thanks a lot for sharing this test framework. I am slowly getting used to Erlang and EUnit.

I miss one feature: the ability to produce XML output of test results. This could be used to publish test reports. e.g. the junit ant task allows specifying a formatter that directs test output into a certain directory.

Could this be added to EUnit, or is it already there?

Thanks!

Martin 

Reply To This
Add Comment
Powered by Atlassian Confluence 2.7.3, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators