[erlang-questions] Structuring an Eunit Suite

Ben Hood 0x6e6562@REDACTED
Wed Jan 14 16:11:00 CET 2009


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

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() ->

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,


PS The link the source is here:


More information about the erlang-questions mailing list