Properly testing an OTP application after initialization
Mon Sep 14 20:42:02 CEST 2020
I have tried EUnit very long ago and found it too error prone, when I
understood that simply forgetting to put _ can lead to changing "list
of tests" to a "test that successfully returns a list".
And I don't see anything good in having 2000 lines of tests in the
same module which is only 300-400.
On Mon, Sep 14, 2020 at 2:25 PM Paulo F. Oliveira
> On Mon, 14 Sep 2020 at 06:07, Max Lapshin <max.lapshin@REDACTED> wrote:
>> I do not understand what fixtures are for.
> It's explained in http://erlang.org/doc/apps/eunit/chapter.html#Fixtures: A "fixture" is some state that is necessary for a particular set of tests to run. EUnit's support for fixtures makes it easy to set up such state locally for a test set, and automatically tear it down again when the test set is finished, regardless of the outcome (success, failures, timeouts, etc.).
>> We test our flussonic in this manner:
>> init_per_suite(Config) ->
>> end_per_suite(Config) ->
> This is probably because you're using Common Test, and not EUnit.
> EUnit can be easily integrated into a module (without having to have a separate test/ folder and other "boilerplate" stuff), via -ifdef(TEST). fun_test() ..., and fixtures just make it that easy to keep all the code in the same place.
More information about the erlang-questions