[erlang-questions] EUnit masquerading as Common Test

Per Melin per.melin@REDACTED
Wed Apr 27 20:05:14 CEST 2011


On Wed, Apr 27, 2011 at 6:47 PM, Ulf Wiger
<ulf.wiger@REDACTED> wrote:
> I, for one, think it's a brilliant idea. :)

Awesome.

I should stress that my application is very light (less than 300
lines) and EUnit is doing all the work.

To illustrate, imagine a module alpha_tests with a single group called
beta with a single test case called gamma. For that I would generate a
structure similar to this and hand it over to EUnit to execute.

{setup,
    fun() -> alpha_tests:init_per_suite([]) end,
    fun(Config) -> alpha_tests:end_per_suite(Config) end,
    fun(Config) ->
        [{setup,
            fun() -> alpha_tests:init_per_group(beta, Config) end,
            fun(Config1) -> alpha_tests:end_per_group(beta, Config1) end,
            fun(Config1) ->
                [{setup,
                    fun() -> alpha_tests:init_per_testcase(gamma, Config1) end,
                    fun(Config2) ->
alpha_tests:end_per_testcase(gamma, Config2) end,
                    fun(Config2) -> fun() ->
alpha_tests:gamma(Config2) end end}]
            end}]
    end}



More information about the erlang-questions mailing list