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:
Changes can be tracked on Process-one forge.
You can report bugs or feature request on Eunit Ticket Tracker
Please post a zip of EUnit - not everyone can get svn access.
Thanks,
Anon
Sorry, didn't see the Attachments tab
Maybe link to the attachment from the page.
Anon
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} ]} errorIs there a more recent stable version than 1.1 (rather old) ?
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,
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).
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.
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