[erlang-questions] Structuring an Eunit Suite
Ben Hood
0x6e6562@REDACTED
Wed Jan 14 16:11:00 CET 2009
Hi,
I'm currently using Eunit in a very agricultural fashion and would
like to use more of the Eunit infrastructure to make the tests less
verbose.
I have a suite of tests that each connect to a message server and
execute a number of commands.
I want to be able to parameterize where the connection supplied from,
so that I can re-use the tests on different transports.
What I've got now is a suite that looks like this:
foo_test() ->
test_util:foo_test(new_connection()).
......
new_connection() ->
%% returns a specific connection to the server
......
and all of the real tests are in the test_util module, e.g:
foo_test(Connection) ->
%% assert something
Ideally I would like eunit to do something like
"foreach _test function in the test_util module, create a new
connection and pass it as a function argument"
Is this possible?
Thanks for any suggestions,
Ben
PS The link the source is here:
http://hg.rabbitmq.com/rabbitmq-erlang-client/file/437d0e4d66c8/src/network_client_test.erl
http://hg.rabbitmq.com/rabbitmq-erlang-client/file/437d0e4d66c8/src/test_util.erl
More information about the erlang-questions
mailing list