[erlang-questions] Unit testing code - whence?

Alex Arnon alex.arnon@REDACTED
Tue Jul 5 23:47:51 CEST 2011


Thank you!

On Wed, Jul 6, 2011 at 12:34 AM, Bob Ippolito <bob@REDACTED> wrote:

> On Tue, Jul 5, 2011 at 2:27 PM, Alex Arnon <alex.arnon@REDACTED> wrote:
> >
> > What are the conventions regarding placement of unit test code and
> > invocation?
> > Considerations:
> > I tend to generate a lot of unit tests - 2x..4x SLOC of the tested
> module's
> > code is not uncommon.
> > Should the unit test functions be placed in their own module?
> > If so - what is the naming convention for the new modue: 'test_mymod' /
> > 'mymod_test' or something else?
>
> Yes. The convention is to place them in test/mymod_tests.erl. These
> will get picked up by rebar eunit.
>
> > What is the preferred way, if there are many small UT functions: function
> > *_test() per UT, or separate into test sets by group, e.g.:
> > api_unit_test_(), internal_unit_test_().
>
> I don't think there is as much consensus for this. I do whatever makes
> sense at the time. I don't try and group tests together unless it's
> easier to write the code that way (e.g. with a list comprehension, or
> if they share the setup/teardown in a foreach).
>
> -bob
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110706/94932654/attachment.htm>


More information about the erlang-questions mailing list